Find out if hardware buttons are pressed

Discuss PocketC for CE (including Desktop Edition)

Postby wolfgang on Tue Mar 27, 2001 9:23 pm


how can I find out if the user has pressed one of the hardware buttons on a PocketPC (specifically Compaq Ipaq)? Does this return any specific events I could trap on? How do I find out which button was pressed? I do not have an Ipaq myself to try it, so I would greatly appreciate any working code snippets I could use directly!


Composing music on the PocketPC! -
Posts: 281
Joined: Tue Dec 12, 2000 4:22 am
Location: USA

Postby Justinespinosa on Wed Mar 28, 2001 5:01 am

You can use them with the PM_KEYUP and PM_KEYDOWN events. the value specifying wich key is pressed is returnd by key(); the problem is that hardware buttons are runing programs when they are pressed.
I know that you can save the names of the associated program into variables and change them. But a softt reset shoudl be needed


OUTS Softwares

OUTS Softwares
Posts: 156
Joined: Wed Dec 06, 2000 2:30 pm
Location: Switzerland

Postby darwin on Thu Mar 29, 2001 4:40 pm

I think, it would work without a soft reset, if you knew the message to reread the registration. I see 3 possibilities
<li>If it is a special message, you will need to develop in eVB or even C++ on the desktop computer an applet that calls that reread function. </li>
<li>Maybe there's an executable somewhere (in /windows/ or on the web) to do the same.</li>
<li>Or you programm an applet in C++ that catches the hardwarekey buttons and post a normal key-code event that can be read by pocketC.</li>
I don't know how to handle this....
Posts: 71
Joined: Tue Dec 05, 2000 12:04 pm
Location: Germany

Postby Shir0t on Thu Apr 12, 2001 11:35 am

All the hardware buttons have keys in the registry that can certainly be pointed towards programs so you could make a program that posted a keycode as a windows message and then intercept it with the key() function. Of course you might also be able to asign the keys straight to keyboard values ( had an app that achieved this).
Posts: 5
Joined: Thu Apr 12, 2001 11:31 am

Postby kjm on Thu Apr 12, 2001 4:28 pm


Eike Decker has written a small programme to check the numbers of keys pressed. Here is the readme file:

KeyCapture 1.0 for PocketC PPC/HPC

Strange Phenomenom

About: With this tool you can find out the keynumbers of the buttons on the device.

History: 29-3-2000 Written the app on a question on the PocketC Webboard

Features: Display the last 15 Key events.

Strange Phenomenom in the web:

I have tried the programme on my E115 and it gives the following codes for the hardware keys:

Action control: up 38 down 40
Cursor button: left 37 up 38 right 39 down 40

The other keys launch programmes, but three of these apparently return codes:
Start Button: 193
Record button: 194
Menu Launcher 195
Both the contacts and calendar buttons don't return codes within this programme.

Posts: 48
Joined: Wed Mar 07, 2001 4:02 pm
Location: United Kingdom

Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 1 guest