Hello all,
I am trying to get my program to emulate keyboard strokes and send to other programs. Currently I am using:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SendMessage(int hWnd, int msg, int wParam, IntPtr lParam);
and this is proving to be a headache. The way I implemented it, it works fine. I can send keystrokes to almost any program but Notepad (dont know why that wont work but I am guessing it is because there is the "Edit" subwindow inside it).
Anyways, people using the software cant figure out the title/class required. So I want to make a global keyboard presser basically. Something that programs with hotkeys can capture and also any program.
Is the basic SendKey function all that is needed? Will this trigger global hotkeys in other programs too? (I want this to happen, not prevent it!)
Is there a way to emulate an actual keyboard somehow? Maybe actually register a virtual keyboard?! I am just thowing out ideas here.
Thanks in advance!
C# Keyboard Emulator, SendKeys, and user32.dll's SendMessage
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Cory Borrow8 pointsPosted Jul 2, 2008, 8:11 AM EDT
http://msdn.microsoft.com/en-us/library/ms646310(VS.85).aspx
sandeep kalra8 pointsPosted Oct 14, 2008, 2:15 AM EDT
Hi can you send me the code of SendMessage function. I facing a challenge to give WM_KEYDOWN and WM_KEYUP event for F1 key on other application using SendMessage function.Please mail me on
[email protected]
Thanks
sandeep kalra8 pointsPosted Oct 14, 2008, 2:15 AM EDT
Hi can you send me the code of SendMessage function. I facing a challenge to give WM_KEYDOWN and WM_KEYUP event for F1 key on other application using SendMessage function.Please mail me on
[email protected]
Thanks
1 short reply
Nick Nichols9 pointsPosted Jun 25, 2008, 4:32 PM EDT