SendKeys.
I have a question about sending keys...
I have try to make a program that you can type in a text in a dialog box,
and then make it write the text into notepad.
but the only function I can find is keybd_event in msdn.. but it only takes,
VK_KEYS.. how can I do this if I whant to send a string? like this.
char string[5] = {"test"};
for(int i=0; i < strlen(string) + 1; i++){
sendKeySomehow(string);
}
you know what I mean... hope anyone can point me somewere..
#include <windows.h>#include <iostream>#include <string.h>#include<conio.h>using namespace std;int main(){ HWND notepad_window = FindWindow("Notepad", NULL); HWND textbox_window = FindWindowEx(notepad_window, NULL, "Edit", NULL); if (!notepad_window) { printf("Could not find Notepad\n"); system("Pause"); return 1; } string my_string; cout << "Enter a word to send to Notepad: "; cin >> my_string; for (int i = 0; i < my_string.size(); i++) SendMessage(textbox_window, WM_CHAR, (int)my_string, 0x80000000); return 0;}
If i have understood you corectly this code should help.
You just have to change it so you enter the text in a dialogbox instead of in a console window.
hope it helps
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement