1.

Solve : C++/API input to notepad.exe?

Answer» HEY Guys,

I'm new to API and basically want to know how to handle a process and send text to it.

I.E.

start notepad.exe
handle notepad.exe
send message "hello world" to handle
destroy handle
return "success"


i would like "hello world' to be printed while notepad is OPEN so if i added sleep 2 seconds between each char i would see it slowly typing
... = sleep 2 seconds
h...e...l...l   .......etc

is this possible?

Thanks in advance.

Here is what you need to do:

Get the handle of the notepad window
Use FindWindowEx to LOCATE the edit control
Then use SendMessage with WM_SETTEXT to put the text into the textbox

The last post here (it's VB, but you can get an idea): http://www.vbforums.com/showthread.php?t=539565Thanks Linux, i still have no idea where to start.

Any chance you could post the complete code so that i can copy paste it and modify... i learn best this wayI SOLVED this on my own here is the code for anyone who wants

Code: [Select]string s = "hello world"
hwnd = FindWindow(NULL, "Untitled - Notepad");
hwndChild = FindWindowEx(hwnd, NULL, "EDIT", NULL);

SendMessage(hwndChild, WM_SETTEXT, NULL, (LPARAM)s.c_str());




Discussion

No Comment Found