locked
Window Message 0xC003 (49155) RRS feed

  • Question

  • Hi,

    I am writing an application on windows mobile phone (smartphone) .
    When my app is running if I press the VK_TEND/VK_F4 key ( red button on the phone ), our window gets the message "0xC003"(49155). But I am not able to figure out what message is this.

    when my app stay Idle for 5 min I get the  "0xC006" (49158) window msg and after that I get the "0xC003"(49155) window msg.
    Can you please tell me what msg  is this and how can capture VK_TEND/VK_F4 key ( red button on the phone ) and handle idle state to prevent my app to hanged.

    Thanks
    - Neha
    New to WinCe
    Monday, February 23, 2009 7:03 AM

Answers

  • Hi Neha,

    RegisterHotkey works on Pocket PC, not SmartPhone. For smartphone, I think hook is the only choice.  There is a good sample written by Alex Yakhnin, you can want to see his blog: Keyboard hook in cf v2. You can find a P/Invoke about the method SetWindowsHookEx.

    Best regards,

    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Thursday, February 26, 2009 7:49 AM

All replies

  • Hi,

    I am writing an application on windows mobile phone (smartphone) .
    When my app is running if I press the VK_TEND/VK_F4 key ( red button on the phone ), our window gets the message "0xC003"(49155). But I am not able to figure out what message is this.

    when my app stay Idle for 5 min I get the  "0xC006" (49158) window msg and after that I get the "0xC003"(49155) window msg.
    Can you please tell me what msg  is this and how can capture VK_TEND/VK_F4 key ( red button on the phone ) and handle idle state to prevent my app to hanged.

    Thanks
    - Neha
    New to WinCe
    • Merged by warrentang Thursday, February 26, 2009 6:10 AM duplicate
    Monday, February 23, 2009 8:16 AM
  • Hello Neha,

    Google is you're friend:


    Greetings,

    Peter Vrenken - MCPD: Enterprise Applications Developer - Sigmax Mobile Solutions
    Work: 
    www.sigmaxmobile.com
    Home: www.petervrenken.nl 
    Mobile Development tools: 
    HeadsUp | uTrack | ANit
    Mobile technology: xTechnology | TransparaM | Pica.Mo | MoBio

    Monday, February 23, 2009 9:23 AM
  • Hi Peter,


    Thanks for reply!
    I saw this thread but it not answer my question why I am getting "0xC006" (49158) window msg and after that I get the "0xC003"(49155)msg in idle state.  It's quiet confusing ! And i donot know how to handle idle state as if window msg =="0xC003"(49155) my app get exit. So if I leave my app idle for 5 min it exit.

    Thanks
    - Neha




    New to WinCe
    Tuesday, February 24, 2009 2:02 AM
  • What's your purpose? What did you mean by "prevent my app to hanged"?
    Please mark the post that helps you, and unmark that does not. This benefits our community members.
    Wednesday, February 25, 2009 8:27 AM
  • HI Neha,

    For capturing RED key, the proper way is using RegisterHotkey to register it and we will handle the message in "WM_Hotkey". Like the code below:

    int iHotKeyID = 0xB000;     
    int error=RegisterHotKey(this->m_hWnd, iHotKeyID, MOD_KEYUP, VK_TEND);    
     
    LRESULT CRegisterTokenTestDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)  
    {  
        // TODO: Add your specialized code here and/or call the base class  
        switch(message)  
        {  
        case WM_HOTKEY:  
            int i=0;  
        }  
        return CDialog::WindowProc(message, wParam, lParam);  
    }  
     

    Best regards,
    Guang-Min Bian - MSFT
    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Wednesday, February 25, 2009 9:59 AM
  • Hi,

    Thanx a lot for reply ! I am working Smartphone C# project. And already did this Hot_key register and capturing them in WndProc.

    As per following code ::

     public const uint WM_HOTKEY = 0x0312;
      private const uint VK_F4 = 0x73; // this is  VK_TEND

     bool ret =  RegisterHotKey(hwnd, (int)WM_HOTKEY, MOD_CONTROL, (int)VK_F4);

     protected virtual int WndProc(IntPtr hwnd, uint msg, uint wParam, int lParam)
           {

                   if(msg == WM_HOTKEY )
                  {

                            If(wParam == VK_F4)
                                    {
                                             exitTheApp();
                                              return 1;
                                    }
                  }

                return keyHook.callWindowProc(hwnd, msg, wParam, lParam);
    }
     UnregisterHotKey(hwnd,(int)VK_F4);



    But instead getting this hotkey value when i press red key  getting msg = 49155 (0xC003) value wParam =0 & lParam = 0.
    Even I am able to capture the Back key in wndProc .. and other Key event msg.

    As I went furtther bit . .Issue is that if i am getting above msg = 49155 and do requier thing for exiting app it works fine but when i leave my app idle for 5 to 10 mins i am getting msg =49155 again and my app got exit in this cond. So issue is why  i am not getting correct "end key " value when i press red key and why i am getting same msg in idle state ? If i donot handle [or donot write exit code in red key press] my app hanged/crashed and if i do handle it, it exit in idle state. 


    If you please help me to solve this issue I will very thankfull. Please let me know if u requier any more info on code.

    Thanks
    - Neha





    New to WinCe
    Thursday, February 26, 2009 4:04 AM
  • Hi Neha,

    RegisterHotkey works on Pocket PC, not SmartPhone. For smartphone, I think hook is the only choice.  There is a good sample written by Alex Yakhnin, you can want to see his blog: Keyboard hook in cf v2. You can find a P/Invoke about the method SetWindowsHookEx.

    Best regards,

    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Thursday, February 26, 2009 7:49 AM