"Home" button on HTC Windows Mobile 6.5 phones

I've got an interesting problem with THC HD Mini with WinMo 6.5 (and I guess it is true for at least few other HTC phones with WM 6.5)

As you can see at the image, Mini has 4 buttons at the bottom: Talk, Home, Menu and End.
"Menu" button is actually good old VK_THOME and shows what was accessible before from clicking "Start" in previous WinMo versions. But "Home" button is more elusive - it shows Today screen.

My goal is to detect (1) what code it generates, or (2) how to simulate it, or (3) how can I achieve the same as "Home" button click, ie force Today screen to be shown - from the application.

Any ideas are very welcome.
LVL 24
Who is Participating?
alexey_gusevConnect With a Mentor Author Commented:
OK, after some spent in Spy++-ing, thinking and googling, I've finally realised that what I see on HTC is manila.exe. Better later than never :)

So, all one has to do is to launch "\Windows\manila.exe" with some command line parameters, and this link provides a good reference:


In case of home page, it's just

CreateProcess(_T("\\Windows\\manila.exe"),_T("--switchtopage home.page"),NULL,NULL,FALSE,0,NULL,NULL,NULL,&pi);

So at the end of the day it's as simple as that :)
Here are the current keys for 6.5.


It seems that  VK_THOME  is still the option for the Home button.
alexey_gusevAuthor Commented:
Hi Mikal,

I'm afraid I should disappoint you :) - VK_THOME is great, but it is generated by a button with "windows logo" on it, and what's more, I do catch it as a hot key with VK_THOME, and even more :), it is defined in SDK as VK_LWIN. This question is purely HTC related.

I've discovered that this Home button generates the code 0xED which is marked as from OEM pool. I was even able to set keyboard hook and catch it within the application, but NOT simulate the click.

So I do appreciate your help, but it's not as easy as simple Google query :)
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

I do not know the answer.

keyb_event and, maybe, SendInput will simulate these hardware buttons very well.
You maybe know, OEM can use own keyboard events - I do not remember all details, it was 2 years ago, I attached the code I have - 0xE9 means something there.

I think in a small windows app you can catch these buttons - it should be WM_SYSKEYDOWN/WM_SYSKEYUP messages.
I'd use this way. :) I'm sure, you will excuse me if I'm wrong.

void EmulateKeyboard()
   keybd_event(0xE9, 0, KEYEVENTF_SILENT, 0);
   keybd_event(0xE9, 0, KEYEVENTF_SILENT | KEYEVENTF_KEYUP, 0);

Open in new window

alexey_gusevAuthor Commented:
@pgnatyuk: ha ha, surely I'll excuse you - I do appreciate your help :)

I'll check EnableHardwareKeyboard() tomorrow. It should be something about the right combination of 'tricks' to get it working :)

Funny thing, if I use keybd_event() with 0xED it generates WM_KEYDOWN/UP with the code 0xE5 (VK_PROCESSING), but doesn't navigate to Today screen.

In the hook function, the virtual code is 0xED, scancode = 0, flags = 0. So I've tried various combinations already, even searched the registry for application keys (there were those in previous versions) - but nada, it doesn't do what I want.

Alternatively, what is the window that contains all menu items on wm6.5 called? It does contain Today icon, but again, I've found all shortcuts but this one under \Windows :)
:( I do not know. I do not work with the Windows Mobile phones now.

You don't want to try WM_SYSKEYDOWN? I think in a fullscreen application, when you will press on these hardware buttons, in the window procedure you can catch them. I think so. It did work for Windows Mobile 5 and 6. I do not remember any change about it in 6.5, so it should work.
Have you checked all kind f GetAsyncKeyState, MapVirtualKey, GetKeyState?

I re-read your question:
>>(3) how can I achieve the same as "Home" button click, ie force Today screen to be shown - from the application

Something like that:
HWND hWnd = FindWindow(_T("DesktopExplorerWindow"), _T("Desktop"));
HWND hWnd = FindWindow(_T("DesktopExplorerWindow"), NULL);
and then
will work?

And this is from Google (please take a look):

MSDN. HardwareKeys Enumeration
MSDN. HardwareButton Class
alexey_gusevAuthor Commented:
I will try WM_SYSKEYDOWN. And DesktopExplorerWindow too. I'm ready to try anything :)

Re. hardware keys - that's what I was looking in the registry for - but didn't find it on HTC HD Mini. I'll recheck tomorrow, and with other HTC models.

Thanks for suggestions, one of them might resolve the problem.
Good luck!
alexey_gusevAuthor Commented:
ok, recent update:

DesktopExplorerWindow partially worked, ie if I'm not in any screens available from Today screen then SetForegroundWindow() does the trick, like from Menu screen or normal applications.  But...if one is located in eg Contacts - the one you can start from today screen - then it looks like it DesktopExplorerWindow is already at the foreground, and it stays where it is
You wanted to simulate the keyboard input?
Do you remember this trick about SetForegroundWindow:
SetForegroundWindow((HWND)(((ULONG) hwnd) | 0x01) );

It's from MSDN: http://msdn.microsoft.com/en-us/library/aa923858.aspx
alexey_gusevAuthor Commented:
doesn't make any difference unfortunately.

HTC has a carousel on its desktop window, so from that point of view it's already foreground.

But maybe I need to explain the problem better.

I have a client/server system, kind of remote control, so the client side shows the skin for the phone, and once the user clicks on the button (Home in this case) this key code is sent to the server (running on the HTC device) and injected. Most of such keys work just fine with keybd_event() or PostKeybdMessage() (didn't try SendInput yet).

I'm fine with any solution which gives me a robust way of mimicking Home button click on HTC. The final result has to be Today screen via whatever trick it is (if any) achievable. If it's possible and necessary to talk directly to the driver I'm glad to give it a go - just tell me how :)
I'm sure this way with GetDesktop and SetForeground worked fine for me on HTC Touch Pro 2 - it also had this Touch Flo guy (that blocked Open GL for me). I will check now on another computer.

I have a trivial code. :(
HWND top = ::GetDesktopWindow();
if (top != NULL)

Probably, you are right and I've never tested this code with a Contacts app running.

alexey_gusevAuthor Commented:
Yes, the difference between htc HD pro and mini is that mini has 5 buttons. 4 of them work, but 5th does not
>>but 5th does not
alexey_gusevAuthor Commented:
DesktopExplorerWindow has few child windows, I've even tried each one in turn for messages with Spy++ - nada, no one received anything when I press Home :|

Do you know that is the window on WM6.5 which holds the menu (with all its icons)? It has Today icon I could try to 'click'. Or alternatively maybe there is some control panel applet for Today icon.

I'm iterating though all possibilities however insane they might sound :)

Good guys at HTC support told me my device is faulty... :)
No, I do not remember already.
I thought that in a separate full-screen app you can catch any keyboard event. So Home button never works? Or it does not work for your app?
alexey_gusevAuthor Commented:
no no, I can catch it in a keyboard hook, but it's not my goal.

I want to simulate the click on it, ie inject the button click sent from the desktop. As a result one should see Today screen.

So it's not about catching the click, but about injecting it. I have a service running and listening to client's connections, then the client sends 'key press' to the service and it has to inject it - that's kind of remote control system for mobile phones.
very strange. :(
if you can catch, why you cannot send the same? Directly to the desktop window, for example. Or broadcast it. But you are right. keyb_event should work and only HTC guys may help. Probably, they made something strange about this button.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.