PDA

View Full Version : P/Invoke assistance


dmarolt
21st January 2008, 06:09 PM
I'm working on an application. This application has several fields which will only have numerical input (Zip code, phone number, part #, etc).

This application runs on Windows Mobile 5 & 6 with a touchscreen and full keyboard (So basically Treo's and HTC phones).

To type a number on these phones, you need to hold down a Function Key, then hit a letter which corresponds to a number. It has been requested to eliminate the need to hit that function key, and have it automatically input the number.

I cannot hard code this because it's certainly not very extensible (Well, I could hard code it, but whatever)

I was thinking I could P/Invoke "keybd_event" the Function key, and it should work from there.

However, I cannot find what key code the "Function" key is.

And also, will this key code be the same across all phones?


I suppose one last note, if you know a better way to achieve this without using P/Invoke, I'm up for new ideas

Thanks for your time,

Dan

Koterpillar
21st January 2008, 08:43 PM
I'm afraid I can't be of much help here, but you for sure *can't* get a Function key code. There isn't. It's deep in the keyboard driver.
However, according to this (http://blogs.msdn.com/windowsmobile/archive/2007/02/06/how-do-you-dial-1-800-flowers.aspx), there's some hook you can ask OS for to convert letters to numbers. But with MS, it might as well be hidden from public...

dmarolt
21st January 2008, 08:48 PM
There has to be some message that's sent to the OS when I hit the Function Key, I just (obviously) don't have Spy++ on my PPC.

dmarolt
21st January 2008, 10:53 PM
I was looking up a few things.

Is there anything relevant contained in keybddr.dll?