procedure FindWin;
var
hCurrentWindow:HWND;
szText:array[0..254] of char;begin
hCurrentWindow :=FindWindow(nil,'Game');
if hCurrentWindow = 0 then//未找到句柄
ShowMessage('Not Found'); if hCurrentWindow<>0 then//找到句柄
begin
if GetWindowText(hCurrentWindow,@szText,255)>0 then
begin
ShowMessage(szText);
GetCursorPos(P);
SendMessage(hCurrentWindow,WM_MBUTTONDBLCLK, P.X, P.Y);
end;
end;
end;为什么游戏game 中没有任何反应?代码中第16行的ShowMessage(szText);已经执行了呀。
var
hCurrentWindow:HWND;
szText:array[0..254] of char;begin
hCurrentWindow :=FindWindow(nil,'Game');
if hCurrentWindow = 0 then//未找到句柄
ShowMessage('Not Found'); if hCurrentWindow<>0 then//找到句柄
begin
if GetWindowText(hCurrentWindow,@szText,255)>0 then
begin
ShowMessage(szText);
GetCursorPos(P);
SendMessage(hCurrentWindow,WM_MBUTTONDBLCLK, P.X, P.Y);
end;
end;
end;为什么游戏game 中没有任何反应?代码中第16行的ShowMessage(szText);已经执行了呀。
var
hCurrentWindow:HWND;
szText:array[0..254] of char;begin
hCurrentWindow :=FindWindow(nil,'Game');
if hCurrentWindow = 0 then//未找到句柄
ShowMessage('Not Found'); if hCurrentWindow<>0 then//找到句柄
begin
if GetWindowText(hCurrentWindow,@szText,255)>0 then
begin
ShowMessage(szText);
GetCursorPos(P);
ScreenToClient(hCurrentWindow,@P); // !!!
SendMessage(hCurrentWindow,WM_MBUTTONDBLCLK, P.X, P.Y);
end;
end;
end;