Sign in to follow this  
Followers 0
kikekoikan

Override Volume up/down with HTC or Sony Ericson Phones

1 post in this topic

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:

{

}

break;

case VK_TVOLUMEDOWN:

{

}

break;

default:

break;

}

break;

}

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

MoDaCo is part of the MoDaCo.network, © Paul O'Brien 2002-2016. MoDaCo uses IntelliTxt technology.