Many of my friends are confused about the window handle. This short article focuses on the spy ++ software. It introduces the form handle and the key plug-in
If a message is sent to the handle, that is, the remote host is suspended.
The spy ++ software comes from VC ++. After installing VC, you can see it in the tool.
Take notepad as an example to see if a key message is sent to notepad.
Start notepad first
Then start spy ++
Use the search function of spy ++
Effect after opening
We drag the black zonestar to the notepad form.
Click "OK". The spy ++ displays the red content.
The three handles are:
Notepad master handle
Text input box handle
Status Bar handle
To send a key message to notepad, We need to select the sending object (handle). Here, we obviously want to send it to the "text input box ". Double-click "text input box" to view "window title", "window size", "window location", and other information. Click the "class" tab to view the class name,CodeClass name as a parameter
Okay, the basic data is available. The following code is provided:
// Open notepad vbscall runapp ("notepad.exe") // wait for notepad to fully open delay 100 // get the current window handle dim hwnd plugin hwnd = Window. foreground () // find the sub-handle dim edithwnd plugin edithwnd = window in the current window. findex (hwnd, 0, "edit", 0) // send the string message plugin window. sendstring (edithwnd, "view sent string messages") // send the carriage return plug-in window. sendkeydown (edithwnd, 13) // send the Keyboard Message plugin window. sendkeydown (edithwnd, ASC ("1 "))