keyevent help please

Discuss PocketC for CE (including Desktop Edition)

Postby bvinas on Mon Jun 04, 2001 10:08 pm

I need some info on keyevent. I want to simulate a Ctrl-C (copy) and Ctrl-V (paste) and Ctrl-X (cut) using keyevent. The documention for pocketC doesn't really give a good example. Does anyone know how this can be implemented.

Also what is the value of KEYEVENTF_KEYUP.


Posts: 43
Joined: Mon Feb 12, 2001 8:15 pm
Location: USA

Postby ryo-h on Tue Jun 05, 2001 12:48 pm

Hi, bvinas.

You can manage it by these steps.

1) Watch for PM_KEYDOWN event for Ctrl key.
2) If you catch it, record the "Down" state in a variable.
3) While the Ctrl key state is "Down", if you catch a PM_KEYDOWN event for C key, you get a "Ctrl-C" combination.
4) If you see PM_KEYUP event for Ctrl key, you change the variable state to "Up".

Hope it'll work for you.
ryo@CE Factory
posting from Bangkok, Thailand

ryo@CE Factory
ryo@CE Factory
Posts: 5
Joined: Sun Jun 03, 2001 5:36 am
Location: Japan

Postby Valerio on Tue Jun 26, 2001 10:05 am

Hi bvinas,

I think it could be done like this:

keyevent(17,0,0,0); //Ctrl Key down
keyevent(67,0,0,0); //'C' Key down
keyevent(17,0,2,0); //Ctrl Key up

I guess that KEYEVENTF_KEYUP is 2 since it works. Actually I have the intention of making a program that reads from the serial port any char and puts it on the current application so that I can write on my PocketPC through my PC keyboard and a terminal program (i.e. Hyperterminal or something like it). I am mapping chars using a modified version of event.pc that can be found somewhere on this site.

Posts: 2
Joined: Tue Jun 26, 2001 9:54 am

Postby guy on Tue Jun 26, 2001 10:34 am

Are you sending key messages because you need to do cut/copy/paste in another application or in your own application?

To cut/copy/paste in your own application it's easier to just send messages to the appropriate control:


PocketC CE API interface:
PCForm and CE API forum:
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Postby bvinas on Tue Jun 26, 2001 10:36 am

I eventually figured that out Guy about the messages, But I still used ryo-h suggestion to get ctrl-n (new) and some other shortcuts working.

Posts: 43
Joined: Mon Feb 12, 2001 8:15 pm
Location: USA

Postby Justinespinosa on Tue Jun 26, 2001 4:15 pm

If someone needs it, i have done a library to use the edit control messages. now including set tab stops. drop me a mail if you need it


OUTS Softwares

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

Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 2 guests