procedure TForm1.Button1Click(Sender: TObject);var hEdit: HWND; str: string;begin str := '准备要添加到记事本的字符串'; WinExec('Notepad.exe', SW_SHOWNORMAL); hEdit := GetWindow(GetForegroundWindow, GW_CHILD); SendTextMessage(hEdit, WM_SETTEXT, 0, str);end;
本文共 301 字,大约阅读时间需要 1 分钟。
procedure TForm1.Button1Click(Sender: TObject);var hEdit: HWND; str: string;begin str := '准备要添加到记事本的字符串'; WinExec('Notepad.exe', SW_SHOWNORMAL); hEdit := GetWindow(GetForegroundWindow, GW_CHILD); SendTextMessage(hEdit, WM_SETTEXT, 0, str);end;
转载于:https://my.oschina.net/hermer/blog/319428