int NotepadSender(const char *strNotepad,const char *strSend)
{
HWND hwnd=NULL;
hwnd=FindWindow(TEXT("Notepad"),strNotepad);
if(hwnd==NULL)return -1;
else{
hwnd=FindWindowEx(hwnd,NULL,TEXT("Edit"),NULL);
if(hwnd==NULL)return -1;
else{
return SendMessage(hwnd,EM_REPLACESEL,0,strSend);
}
}
}
using method:NotepadSender("无标题 - 记事本","hello,world")
可以查一下MSDN,或者google一下