Guest kikekoikan Posted April 16, 2009 Report Share Posted April 16, 2009 (edited) Hello, I want to get the volume up/down key events in my application. To do that I create a menu bar and then receive the event in WM_HOTKEY or WM_KEYUP. This method works well with Samsung phones or emulator but not with HTC phones. Here is my code : Creation of the menu bar in WM_CREATE : SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hWnd; mbi.nToolBarId = IDR_MENU; mbi.hInstRes = g_hInst; if (!SHCreateMenuBar(&mbi)) { g_hWndMenuBar = NULL; } else { g_hWndMenuBar = mbi.hwndMB; SendMessage(g_hWndMenuBar, SHCMBM_OVERRIDEKEY, VK_TVOLUMEUP,MAKELPARAM (SHMBOF_NODEFAULT | SHMBOF_NOTIFY,SHMBOF_NODEFAULT | SHMBOF_NOTIFY)); SendMessage(g_hWndMenuBar, SHCMBM_OVERRIDEKEY, VK_TVOLUMEDOWN,MAKELPARAM (SHMBOF_NODEFAULT | SHMBOF_NOTIFY,SHMBOF_NODEFAULT | SHMBOF_NOTIFY)); } Receive the event in WM_KEYUP : case WM_KEYUP: { switch(wParam) { case VK_TVOLUMEUP: { printf("event up"); } break; case VK_TVOLUMEDOWN: { printf("event up"); } break; default: break; } break; } I hope you can help me Good afternoon Edited April 16, 2009 by kikekoikan Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now