This site is no longer active and is available for archival purposes only. Registration and login is disabled.

How to send keyboard input to other running program?


How to send keyboard input to other running program?

Postby Rayman » Jun 26, 2002 @ 9:53am

I would like to implement a function like this:
My program is running in the background, and register a hotkey associated with a hardware button. when the button was pressed, my program will send a "Ctrl+C" to the foreground program(for example PocketWord). the key function is like this:

void SendCtrlC()
{
keybd_event(...);
keybd_event(...);
...
Sleep(0);
}

The code works perfect under PPC 2002 emulator, but just won't work under my IPaq! Anyone can give me some hints?
Rayman
 


Postby refractor » Jun 26, 2002 @ 10:37am

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Rayman » Jun 26, 2002 @ 11:42am

Rayman
 


Postby refractor » Jun 26, 2002 @ 12:07pm

#2 Weird.

#3
Sorry about the GetActiveWindow thing - I didn't read the MSDN page properly :oops:

However, maybe:

HWND GetForegroundWindow(void);

Will give you the active window? It doesn't mention anything about it being thread-specific.

If it doesn't work, let me know and I'll see if it works on mine.

Why isn't a WM_COPY enough?

Cheers,

Refractor
User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Rayman » Jun 26, 2002 @ 4:30pm

Rayman
 


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron