Here is a complete working snippet that will give you a window handle, a target sub window, and send a message to this sub-sub.
#include "TCHAR.h" #include "Windows.h" int _tmain(int argc, _TCHAR* argv[]) { HWND hwndWindowTarget; HWND hwndWindowNotepad = FindWindow(NULL, L"Untitled - Notepad"); if (hwndWindowNotepad) {
At the moment, he will send the letter G to the โUntitledโ notebook (open a new notebook, do nothing.
You can find the helper window using spy++ , which comes with visual studio.
Here is an example of using SendInput to send mouse events:
#include "TCHAR.h" #include "Windows.h" int _tmain(int argc, _TCHAR* argv[]) { POINT pt; pt.x = 300; pt.y = 300; HWND hwndWindowTarget; HWND hwndWindowNotepad = FindWindow(NULL, L"Untitled - Notepad"); if (hwndWindowNotepad) {
}
Serdalis Apr 23 2018-12-12T00: 00Z
source share