|
Advertisement
|
|
Advertisement
No logs - Anonymous IP
|
 |

12-15-2010, 05:49 PM
|
|
Wealthy Merchant
|
|
Join Date: Jan 2009
Location: Orlando Florida
Thanks: 50
Thanked 24 Times in 18 Posts
|
|
How do programs send simulated keystrokes?
hey guys. i've been working a lot with AutoIT, making some huge macros, but I'm thinking how nice it would be to build these kinds of things in a non-scripted environment. Using a C-based language or something.
I've never done any windows programming, but I suppose that's how these programs work? They can move the mouse, send simulated keystrokes, find the names of windows and windows components of windows, and find pixel values at various points in the window
So, what technology do these guys employ?
|

12-15-2010, 05:55 PM
|
 |
Destroyer of worlds
|
|
Join Date: Jan 2009
Location: Buenos Aires, Argentina.
Thanks: 1,376
Thanked 2,005 Times in 1,139 Posts
|
|
Re: How do programs send simulated keystrokes?
Shazam! http://www.codeproject.com/KB/cpp/se...p_Article.aspx
Quote:
The core functionality of sending keys in CSendKeys revolves around the usage of the keybd_event() Win32 API function.
The keybd_event() produces a keystroke, however the keyboard driver's interrupt handles the calls to this function, which means we can send almost any key combination with less limitations.
In brief, it allows you to send a virtual key, defined in winuser.h as VK_XXX, and a flag which denotes a KeyDown, KeyUp or state to tell if the VKey is an extended key or not.
Normal characters are translated into virtual keys using the VkKeyScan() which takes a CHAR and returns a WORD denoting a VK.
When you send a key, it will be depressed until you send it again with the KEYEVENTF_KEYUP flag.
|
|

12-15-2010, 05:59 PM
|
|
Slightly Grander Duke
|
|
Join Date: Jan 2009
Thanks: 440
Thanked 525 Times in 324 Posts
|
|
Re: How do programs send simulated keystrokes?
You are working under Windows, I assume?
To work with a window, you first need to find a window's handle. There are Windows API functions to do that, say, through window title etc. Keep in mind that in Windows, everything is a window - buttons, controls are all windows too.
Once you have a handle of a window, you can send events to that window. Basically, that's how a window knows that a user has pressed a button - it listens for events, and the OS sends it the event if it occurs. You will be generating such events manually.
You can also paint on these windows, get their pixel values, even cut them (to get, say, a window in the shape of a circle).
At least that's how it worked in the past, I don't think much has changed though. Last I did something like that was about 5 years ago.
|

12-15-2010, 07:22 PM
|
|
Wealthy Merchant
|
|
Join Date: Jan 2009
Location: Orlando Florida
Thanks: 50
Thanked 24 Times in 18 Posts
|
|
Re: How do programs send simulated keystrokes?
Thanks both of you for your informative replies. I'm going to do some basic windows programming of my own!
|
 |
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
|
Looking for some programs
|
Twin Gats |
Visual Arts |
6 |
12-04-2010 04:31 PM |
|
Programs
|
upinsmoke |
Network Security & Hacking |
3 |
02-18-2010 04:13 PM |
|
Macro programs
|
Mirana |
Fragyard |
3 |
06-10-2009 05:32 PM |
|
Macro programs
|
Mirana |
Technophiles and Technophiliacs |
6 |
06-10-2009 05:25 PM |
|
Essential programs
|
cheech |
Technophiles and Technophiliacs |
19 |
04-23-2009 12:58 PM |
All times are GMT. The time now is 11:41 AM.
|
|
Hot Topics |
| | | | | | | | | | | | | | |
On IRC |
Users: 4
Messages/minute: 0
Topic: "http://www.zoklet.net/..."
|
Users: 22
Messages/minute: 0
Topic: "ask ibm why atlantis is real"
|
Users: 10
Messages/minute: 0
Topic: "vaginaboob"
|
Advertisements |
|
Your ad could go right HERE! Contact us!
|
|