Smartphone: Back key

H

Hilton

Hi,

I have an app that have numerous pages. These 'pages' are controls with
controls in them (only one page is visible at any one time). When I tap on
the Back Key (emulator), it minimizes the app. I tried adding KeyPress in
the main form, I also tried adding KeyPress in the page's main control,
neither see the ESC key. If for example, the focus is a listview and the
user presses the Back key, who gets 'told' and what do they get told? Do I
need to add a KeyPress to ListView and all other controls I use? Is there
an easier way?

I have searched the web, but all I have found is "Add KeyPress to the Form".

Thanks!

Hilton
 
H

Hilton

Fabien,

I (once) tried the functions you mention, but even when my app was
minimized, it was still grabbing the keystrokes. Should I have registered
with Activated and Unregistered with Deactivated? (I ran out of time to try
this).

Thanks!

Hilton

Hi,

Check out this functions : UnregisterHotKey/RegisterHotKey.

BR


Fabien Decret
Windows Embedded Consultant


ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/





Hilton a écrit :
 
H

Hilton

Rob,

This is the article to which I was referring. It says put KeyPress in the
form code, but my initial tests show that the form never receives a
keypress - which makes sense wince another control had the focus.

Hilton
 
L

LiYin

I scratched two section codes of mine , maybe will help you:

Step 1(add after MenuBar have been created):
HWND hMenuBar = ::SHFindMenuBar( GetSafeHwnd() );
if ( hMenuBar )
{
::SendMessage( hMenuBar , SHCMBM_OVERRIDEKEY , VK_TBACK , MAKELPARAM(
SHMBOF_NOTIFY | SHMBOF_NODEFAULT, SHMBOF_NOTIFY | SHMBOF_NODEFAULT ) );
// Save the Handle of Menu [ 9:55 10/30/2006 LiYin]
m_hMenu = (HMENU) ::SendMessage( hMenuBar, SHCMBM_GETMENU, 0, 0);
}

Step2: (Catch the back key message)
// Catch the WM_HOTKEY message [ 16:19 10/26/2006 LiYin]
if ( message == WM_HOTKEY )
{
if ( HIWORD( lParam ) == VK_TBACK )
{
SHSendBackToFocusWindow( message , wParam , lParam );
return TRUE;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top