Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Smartphone: Back key

0 views
Skip to first unread message

Hilton

unread,
Nov 6, 2006, 1:30:29 PM11/6/06
to
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


Fabien

unread,
Nov 6, 2006, 3:15:20 PM11/6/06
to
Hi,

Check out this functions : UnregisterHotKey/RegisterHotKey.

BR


Fabien Decret
Windows Embedded Consultant


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

Hilton a écrit :

ro...@mageware.com

unread,
Nov 6, 2006, 3:38:03 PM11/6/06
to

Hilton

unread,
Nov 6, 2006, 3:52:01 PM11/6/06
to
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

"Fabien" <fab_0...@msn.com> wrote in message
news:1162844120.2...@k70g2000cwa.googlegroups.com...

Hilton

unread,
Nov 6, 2006, 3:53:19 PM11/6/06
to
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


<ro...@mageware.com> wrote in message
news:1162845483.6...@h54g2000cwb.googlegroups.com...

LiYin

unread,
Nov 6, 2006, 8:30:09 PM11/6/06
to
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;
}
}


"Hilton" <nos...@nospam.com> wrote in message
news:9bL3h.2177$vP1...@newssvr13.news.prodigy.com...

0 new messages