I was wondering how to target a specific window with key strokes/mou开发者_如何学运维se clicks anyone able to help?
(Regarding your comment to your question) If the button is a standard BUTTON
control, find its handle and send a BM_CLICK
message to it (take note of the remarks in the documentation for when the dialog is not active).
how to search for a 'window' in the OS, if the OS is windows:
function FindWindowExtd(partialTitle: string): HWND;
var
hWndTemp: hWnd;
iLenText: Integer;
cTitletemp: array [0..254] of Char;
sTitleTemp: string;
begin
hWndTemp := FindWindow(nil, nil);
while hWndTemp <> 0 do begin
iLenText := GetWindowText(hWndTemp, cTitletemp, 255);//search after the partial name
sTitleTemp := cTitletemp;
sTitleTemp := UpperCase(copy( sTitleTemp, 1, iLenText));
partialTitle := UpperCase(partialTitle);
if pos( partialTitle, sTitleTemp ) <> 0 then
Break;
hWndTemp := GetWindow(hWndTemp, GW_HWNDNEXT);
end;
result := hWndTemp;
end;
here you have how to send mouse clicks to a 'window'
http://delphi.about.com/od/vclusing/a/mouseadvanced.htm
how to send keystrokes to another application from Delphi
http://delphi.about.com/od/adptips2004/a/bltip1104_3.htm
if you want something else then modify your question
精彩评论