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);已经执行了呀。

解决方案 »

  1.   

    应该是游戏中屏蔽了WM_MBUTTONDBLCLK消息吧?
      

  2.   

    WM_MBUTTONDBLCLK现在很少人用3键的鼠标吧?
      

  3.   

    是不是坐标需要转换,ClientToScreen & ScreenToClient
      

  4.   

    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);
       ScreenToClient(hCurrentWindow,@P); // !!!
       SendMessage(hCurrentWindow,WM_MBUTTONDBLCLK, P.X, P.Y);
      end;
     end;
    end;
      

  5.   

    楼上朋友谢谢了,不过还是不行,但我已经找到方法了用mouse_event 谢谢大家