Jump to content


Photo

Override Volume up/down with HTC or Sony Ericson Phones

- - - - -

  • Please log in to reply
No replies to this topic

#1
kikekoikan

kikekoikan

    Newbie

  • Members
  • Pip
  • 2 posts
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 by kikekoikan, 16 April 2009 - 04:00 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users