Board index » cppbuilder » Q: Keystroke to console application

Q: Keystroke to console application


2006-12-19 07:25:58 PM
cppbuilder108
Hi,
I need to send (simulate) key presses to a console apllication.
I already have a pipe to that apllication for std-out reading
and supposed I could use this for that purpose like:
WriteFile(WritePipeHandle,"q",1,&bytesWritten,NULL);
but this seems not to be the same as pressing the "q" character
on the keyboard.
Can someone help me out?
Chris.
 
 

Re:Q: Keystroke to console application

Chris K wrote:
Quote
I need to send (simulate) key presses to a console apllication.
Did you try keybd_event()?
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
www.leunen.com/
----------------------------------------
 

Re:Q: Keystroke to console application

Quote
Did you try keybd_event()?
I found it (wasn't described in my old API docs).
I can use this but I'll have to make the console application
window active first before using it.
I know there are ways to do this if I have a handle to it
but have to look it up.
Thanks,
Chris.
"Michel Leunen" < XXXX@XXXXX.COM >schreef in bericht
Quote
Chris K wrote:

>I need to send (simulate) key presses to a console apllication.

Did you try keybd_event()?

Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
www.leunen.com/
----------------------------------------
 

{smallsort}