A lot of friends are confused about the window handle, this essay is mainly about Spy + + software, introduction of the following form handle and the use of key plug-ins
, if you send a message to this handle, that is, the so-called background hanging machine.
Spy + + This software from VC + +, installed a good VC, you can see in the tool.
Let's take "notepad" for example and see if you send a key message to Notepad.
Start Notepad first
Then start Spy + +
Using Spy + + lookup features
The effect after the point is opened
We'll drag the Black star onto the Notepad form.
Then click OK to see that Spy + + has shown the following figure red content.
These three handles are from top to bottom:
Main handle of Notepad
Handle of text input box
Handle to status bar
We want to send a key message to Notepad, we need to select the right to send the object (handle), here obviously, we want to send to the "Text input box." We double-click the "Text input box" Here, you can see "window title", "Window Size", "window position" and other information. Click on the "Class" tab to see what the next class name is, the code needs the class name to do parameters
Well, the basic data is available, the following code:
[Plain] View plain copy print? Open Notepad Vbscall runapp ("notepad.exe")/wait for Notepad to completely open Delay 100//Get current Window Handle Dim hwnd Plugin hwnd=window.foreground ()/check Find the clause handle under the current window Dim editHWnd Plugin Edithwnd=window.findex (hwnd,0, "Edit", 0)//Send string message Plugin window.sendstring (editHWnd, "see I send a string message ")//Send carriage return Plugin window.sendkeydown (edithwnd,13)//Send keyboard message Plugin window.sendkeydown (" 1 ")