How to capture start(windows key) virtual key ? RRS feed

  • Question

  • hi,

    How to capture start(windows key) virtual key  ?

    What is virtual key is start key ?

    VK_THOME  ?


    Tuesday, October 27, 2009 7:32 AM


All replies

  • Tuesday, October 27, 2009 7:36 AM
  • OH, Thanks so much.

    but , How can i disabled start(windows key) virtual key when my app running ?

    I can disabled softleft virtual key using  RegisterHotKey(.......) and WM_HOTKEY message .


    Tuesday, October 27, 2009 7:59 AM
  • Hi,

    Change Hardwarekeys.ApplicationKey property according to the hotkey which you want to disable.

    //For Hardware Button(LandScapeMode
            private HardwareButton hwb2;
     /// <summary>
            ///  For Hardware Button
            ///  To Disable the Landscape Mode when the When the Hardware Button is Pressed on Pocket PC
            /// </summary>
            public static int i;
            private void HBConfigActivate()
               this.KeyPreview = true;
                    hwb2 = new HardwareButton();            
                    hwb2.AssociatedControl = this;
                    //LandScape Butoon is intilased to hwb2
                    hwb2.HardwareKey = HardwareKeys.ApplicationKey2;
                catch (Exception exc)
                    MessageBox.Show(exc.Message + " Check if the hardware button is physically available on this device.");
                this.KeyUp += new KeyEventHandler(this.OnKeyUp);
    //To Activate
            private void HBConfigDeActivate()
                this.KeyPreview = false;
                hwb2.AssociatedControl = null;            
                hwb2.HardwareKey = 0;
                this.KeyUp -= new KeyEventHandler(this.OnKeyUp);
     // When a hardware button is pressed and released,
            // this form receives the KeyUp event. The OnKeyUp
            // method is used to determine which hardware
            // button was pressed, because the event data
            // specifies a member of the HardwareKeys enumeration.
            private void OnKeyUp(object sender, KeyEventArgs e)
                //if (GetText(GetForegroundWindow()).ToString() == "Causerie")
                    switch ((HardwareKeys)e.KeyCode)
                        case HardwareKeys.ApplicationKey2:
                            if (i % 2 == 0)
                            MessageBox.Show( "does not currently support the Landscape .");

    Please let me know if it does not work.


    • Marked as answer by guguqiaqia Tuesday, October 27, 2009 9:20 AM
    • Unmarked as answer by guguqiaqia Tuesday, October 27, 2009 9:20 AM
    Tuesday, October 27, 2009 8:28 AM
  • oh, thanks .

    but ,I worked in WIN32 C++, not c#.

    Tuesday, October 27, 2009 9:15 AM
  • I don't think you are supposed to override the start button. But if you insist on doing so, you could use keyboard hooks (SetWindowsHookEx function with a WH_KEYBOARD_LL flag). The SetWindowsHookEx function is undocumented for Windows CE/Mobile. Please refer to the folllowing article for the implications of using an undocumented function:

    Please mark the post that helps you, and unmark that does not. This benefits our community members.
    • Marked as answer by warrentang Sunday, November 1, 2009 2:56 AM
    Thursday, October 29, 2009 6:48 AM
  • Hi Malleswar,

    I would like to capture 'Home' Key event. How can I do it with your way?




    Thursday, February 2, 2012 6:18 PM