Question: I'm working on writing an application that straddles the line between C# and C/++ on Windows Mobile 6.1/6.5. We currently have a kiosk application running on our devices, and would like to add the ability to switch back and forth to a second kiosk application.

Our goal is to establish a global hot key that switches process windows (similar to the way that alt+tab works) whenever it is pressed. We already have both applications and I've written some code that switches the processes, but am having a rough time getting the global hot key portion of the project working.

From all of the reading that I've done, my understanding is that the best way to monitor global key presses is to link into the system message pump with [the SetWindowsHookEx function in coredll.dll](http://www.pinvoke.net/default.aspx/user32.setwindowshookex). Unfortunately, I've also read that this function isn't technically supported on the platform. 

I also found some tutorials that suggested using a message map with the ON\_WM\_KEYUP/ON\_WM\_KEYDOWN macros in the MFC framework, but couldn't find any documentation specific to Windows Mobile. When I tried to use [the documentation here](http://www.codeproject.com/KB/cpp/Introduce_Yourself_to_VC.aspx?display=Mobile#4), my device kept crashing.

Is there an accepted best practice for setting some kind of global key hook on the platform? If not, is there something that's at least technically supported?

Thanks in advance.

ReplyQuote

Answer: 
You need to specify the data text fields and data value fields. 

```
   ddlStatus.DataTextField = "StatusName";
   ddlStatus.DataValueField = "StatusId";

```
You need to set

```
ddl.DisplayMember = "StatusName";
ddl.ValueMemeber = "StatusId";

```