以前见到一大哥写的。你看看有没有帮助。 The IsWindow function determines whether the specified window handle identifies an existing window. BOOL IsWindow( HWND hWnd // handle of window ); ParametershWndSpecifies the window handle. Return ValuesIf the window handle identifies an existing window, the return value is nonzero. If the window handle does not identify an existing window, the return value is zero.
procedure TForm1.Button1Click(Sender: TObject); var hNotepad : Hwnd; begin hNotePad := FindWindow('NOTEPAD',nil); if hNotePad > 0 then SetWindowText(hNotePad,'Good'); end;
利用CreateProcess的返回参数lpProcessInformation.dwThreadId
The IsWindow function determines whether the specified window handle identifies an existing window. BOOL IsWindow( HWND hWnd // handle of window
);
ParametershWndSpecifies the window handle. Return ValuesIf the window handle identifies an existing window, the return value is nonzero.
If the window handle does not identify an existing window, the return value is zero.
var
hNotepad : Hwnd;
begin
hNotePad := FindWindow('NOTEPAD',nil);
if hNotePad > 0 then SetWindowText(hNotePad,'Good');
end;