For Programmers: Free Programming Magazines  


Home > Archive > Smartphone Developer Forum > October 2005 > How to handle the events from the smartphone menu bar?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to handle the events from the smartphone menu bar?
krishna

2005-10-26, 7:02 pm

I have created a menu bar say OK associated with LSK(Left soft Key) along
with the CreateWindow(),On pressing OK key it leads to the same parent window
but only the Menu bar has been modified to NEW(LSK) and OPTIONS(RSK).Now when
i press either RSK or LSK, wndproc doesnt able to handle this menu event.How
to go ahead with this scenario...can anyone help me out!!!
Matt

2005-10-26, 7:02 pm

Can you show me some sample code, like how you create the menu bar, how
you change it to be OK, and maybe your message map?

Matt

krishna

2005-10-26, 7:02 pm

Hi Matt

SHMENUBARINFO mbi;
ZeroMemory(&mbi, sizeof(SHMENUBARINFO));
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent = hwnd;
mbi.nToolBarId = IDR_MENUBAR1; //Loading the Menu bar from the
resource template in which LSK ism associated with OK
mbi.hInstRes = g_hInst;
SHCreateMenuBar(&mbi);

On Pressing OK ,WM_COMMAND processess the menu event OK

WM_COMMAND:
IDOK:
SHMENUBARINFO mbi;
ZeroMemory(&mbi, sizeof(SHMENUBARINFO));
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent = hwnd;
mbi.nToolBarId = IDR_MENUBAR2; //Loading the Menu bar from the
resource template in which LSK is associated with New and RSK is associated
with Options
mbi.hInstRes = g_hInst;
SHCreateMenuBar(&mbi);

Now On pressing LSK or RSK doesnt respond,WM_COMMAND doesnt able to precess
the menu events(New or Options)



"Matt" wrote:

> Can you show me some sample code, like how you create the menu bar, how
> you change it to be OK, and maybe your message map?
>
> Matt
>
>

Matt

2005-10-26, 7:02 pm

Why don't you try putting this into your code into your header and take
what is in WM_COMMAND and make it a function.

BEGIN_MSG_MAP(<Class Name> )
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(<Name of LSK>, <function to run> )
END_MSG_MAP()

The function will need to follow this format or it won't work:
LRESULT <function name>(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
bHandled)

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com