Internet explorer - Toolbar using band objects (Text box - Backspace issue)

Unanswered Internet explorer - Toolbar using band objects (Text box - Backspace issue)

  • Tuesday, August 07, 2012 4:25 AM
     
     

    I have created a IE toolbar with a textbox using "band objects" but the textbox does not respond to "accelerated keys" (backspace,del,enter,home....etc)...any help??? 

    My Band object...also implements...

    code in c#

     /// <summary>
            /// Called explorer when focus has to be chenged.
            /// </summary>
            public virtual void UIActivateIO(Int32 fActivate, ref MSG Msg)
            {
                if (fActivate != 0)
                {
                    Control ctrl = GetNextControl(this, true);//first
                    if (ModifierKeys == Keys.Shift)
                        ctrl = GetNextControl(ctrl, false);//last

                    if (ctrl != null) ctrl.Select();
                    this.Focus();
                }
            }

            public virtual Int32 HasFocusIO()
            {
                return this.ContainsFocus ? 0 : 1; //S_OK : S_FALSE;
            }


            [DllImport("user32.dll")]
            public static extern int TranslateMessage(ref MSG lpMsg);

            [DllImport("user32", EntryPoint = "DispatchMessage")]
            static extern bool DispatchMessage(ref MSG msg);


            /// <summary>
            /// Called by explorer to process keyboard events. Undersatands Tab and F6.
            /// </summary>
            /// <param name="msg"></param>
            /// <returns>S_OK if message was processed, S_FALSE otherwise.</returns>
            public virtual Int32 TranslateAcceleratorIO(ref MSG msg)
            {
                if (msg.message == 0x100)//WM_KEYDOWN
                {
                    if ((uint)msg.wParam == (uint)Keys.Tab || (uint)msg.wParam == (uint)Keys.F6)//keys used by explorer to navigate from control to control
                    {
                        if (SelectNextControl(
                                ActiveControl,
                                ModifierKeys == Keys.Shift ? false : true,
                                true,
                                true,
                                false)
                            )
                            return 0;//S_OK
                    }
                    else
                    {
                        //This sends messages for the backspace, home and other keys.
                        TranslateMessage(ref msg);
                        DispatchMessage(ref msg);
                        return 0;//S_OK
                    }
                }
                return 1;//S_FALSE
            }

    -------------------------------------------

    Does anyone have any tips for me regarding this problem. I still haven't found anything on the internet that has worked for me. Any pointer would be appreciated....Tks

    code in c#
    • Edited by AsnSam777 Tuesday, August 07, 2012 5:49 AM
    •  

All Replies

  • Tuesday, August 07, 2012 4:21 PM
     
     

    On 8/7/2012 12:25 AM, AsnSam777 wrote:

    I have created a IE toolbar with a textbox using "band objects" but the textbox does not respond to "accelerated keys" (backspace,del,enter,home....etc)...any help???

    Your toolbar doesn't implement IInputObject interface, or implements it incorrectly.


    Igor Tandetnik

  • Wednesday, August 08, 2012 6:53 AM
     
     

    Hi Ignor Tandetnik,

    Could you pls share any ideas on implementing theIInputObject 

    by the way ....I have implemented IInputObject interface....in band object....

    public interface IInputObject
    {
    void UIActivateIO(Int32 fActivate, ref MSG msg);

    [PreserveSig]
    //[return:MarshalAs(UnmanagedType.Error)]
    Int32 HasFocusIO();

    [PreserveSig]
    Int32 TranslateAcceleratorIO(ref MSG msg);
    }

    -------------------

    /// <summary>
            /// Called by explorer to process keyboard events. Undersatands Tab and F6.
            /// </summary>
            /// <param name="msg"></param>
            /// <returns>S_OK if message was processed, S_FALSE otherwise.</returns>
            public virtual Int32 TranslateAcceleratorIO(ref MSG msg)
            {
                if (msg.message == 0x100)//WM_KEYDOWN
                {
                    if ((uint)msg.wParam == (uint)Keys.Tab || (uint)msg.wParam == (uint)Keys.F6)//keys used by explorer to navigate from control to control
                    {
                        if (SelectNextControl(
                                ActiveControl,
                                ModifierKeys == Keys.Shift ? false : true,
                                true,
                                true,
                                false)
                            )
                            return 0;//S_OK
                    }
                    else
                    {
                        //This sends messages for the backspace, home and other keys.
                        TranslateMessage(ref msg);
                        DispatchMessage(ref msg);
                        return 0;//S_OK
                    }
                }
                return 1;//S_FALSE
            }
    -------------------------------------------------------------------------------

    i hope i have implemented it correctly????/ Any help??? Any pointer would be appreciated....Tks

    • Edited by AsnSam777 Thursday, August 09, 2012 3:42 AM
    •  
  • Thursday, August 09, 2012 1:57 PM
     
     

    Now iv noticed that the "Accelerated keys" (backspace, home. end....etc) does not work in google.com(web page)

    but works on a few other pages after pressing TAB

    Any help??? Any pointer would be appreciated....Tks

  • Thursday, August 09, 2012 2:20 PM
     
     

    AsnSam777 wrote:

    by the way ....I have implemented IInputObject interface....

    That still leaves "implemented incorrectly" hypothesis.


    Igor Tandetnik

  • Thursday, August 09, 2012 4:18 PM
     
     

    Any help??? 

    Could u pls share any code...on implementation of  IInputObject interface.... Any pointer would be appreciated....Tks!!!!

  • Thursday, August 09, 2012 5:04 PM
     
     

    On 8/9/2012 12:18 PM, AsnSam777 wrote:

    Any help???

    http://msdn.microsoft.com/en-us/magazine/cc301438.aspx
    (second question)

    http://code.msdn.microsoft.com/windowsdesktop/CSIEExplorerBar-ba8fe182


    Igor Tandetnik

  • Monday, August 13, 2012 12:19 PM
     
     
    How do i force the focus to the textbox,  so that the backspace works when i select the textbox with the mouse.
  • Monday, August 13, 2012 12:42 PM
     
     

    AsnSam777 wrote:

    How do i force the focus to the textbox, so that the backspace works  when i select the textbox with the mouse.

    With SetFocus, of course. After you do, don't forget to report to the  browser that you got the focus, by calling  IInputObjectSite::OnFocusChangeIS


    Igor Tandetnik

  • Monday, August 13, 2012 12:45 PM
     
     

    Igor Tandetnik <itandetnik@mvps.org> wrote:

    AsnSam777 wrote:

    How do i force the focus to the textbox, so that the backspace works  when i select the textbox with the mouse.

    With SetFocus, of course.

    I forgot you were using .NET. There, you call Focus() method of the  control.


    Igor Tandetnik

  • Monday, August 13, 2012 1:10 PM
     
     

    Im using c# :

    //in the code...
      public partial class Toolbar : BandObject
        {
    //i have implemented:
           toolStripTextBox1.GotFocus += new EventHandler(toolStrip_GotFocus);
           toolStripTextBox1.Focus();

    //and the following class
            private void TextBox_GotFocus(object sender, EventArgs e)
            {
                this.OnGotFocus(e);
            }
            public override int TranslateAcceleratorIO(ref MSG msg)
            {
                MessageBox.Show(msg.ToString());
                TranslateMessage(ref msg);
                DispatchMessage(ref msg);
                return 0;
            }

    But the browser keeps crashing....


    • Edited by AsnSam777 Monday, August 13, 2012 1:10 PM
    •  
  • Monday, August 13, 2012 1:16 PM
     
     

    AsnSam777 wrote:

    Im using c# :

    //in the code...
    public partial class Toolbar : BandObject
    {
    //i have implemented:
    toolStripTextBox1.GotFocus += new EventHandler(toolStrip_GotFocus);
    toolStripTextBox1.Focus();

    //and the following class
    private void TextBox_GotFocus(object sender, EventArgs e)
    {
    this.OnGotFocus(e);
    }

    What's in toolStrip_GotFocus? What's in OnGotFocus?


    Igor Tandetnik

  • Monday, August 13, 2012 1:28 PM
     
     

    toolStrip_GotFocus -> Function to force the Focus on toolbar textbox.

    The OnGotFocus -> method that ive implemented. (Notifies explorer on focus change)

    *The OnGotFocus method is called before any event handler for the GotFocus event is called.
    • Edited by AsnSam777 Monday, August 13, 2012 1:30 PM
    •  
  • Monday, August 13, 2012 2:49 PM
     
     

    On 8/13/2012 9:28 AM, AsnSam777 wrote:

    toolStrip_GotFocus -> Function to force the Focus on toolbar textbox.

    So you are attaching a handler to GotFocus event on the text box that immediately calls Focus on that same text box? Which triggers GotFocus event, which results in Focus() call, which triggers GotFocus event, which... Do you see a problem with that?


    Igor Tandetnik

  • Monday, August 13, 2012 4:20 PM
     
     

    i found this solution from "http://social.msdn.microsoft.com/Forums/en/ieextensiondevelopment/thread/787f86f7-e92f-4d53-98c0-1a46dfc06dcc"

    that claimed to work .....but hangs for me....!!!!

    any help...??? Any pointer would be appreciated....Tks


    • Edited by AsnSam777 Tuesday, August 14, 2012 1:08 PM
    •