Procedure TForm1. Button1Click (Sender: TObject);
Var
Fu zi, sun: Thandle;//the father, son, Sun San handle
Ps: TPoint;
The begin
Fu:=FindWindow (' Client - I4194304 ', 'battlefield 2 official server');
If fu<> 0 then
The begin
Zi:=FindWindowEx (fu, 0, nil nil);
//
If zi<> 0 then
The begin
Sun:=FindWindowEx (zi, 0, nil nil);
end;
If sun<> 0 then
The begin
PostMessage (fu, WM_SYSCOMMAND, SC_RESTORE, 0);
end;
end;
The SetForegroundWindow (FU);
Sleep (5000);
The GetCursorPos (ps);
SetCursorPos (ps. X, ps. Y);
Sleep (100);
//SendMessage (zi, WM_LBUTTONDBLCLK, 0, 0).
SendMessage (fu, WM_NCACTIVATE, WA_ACTIVE, 0);
SendMessage (fu, WM_LBUTTONDOWN, 0, 0);
SendMessage (fu, WM_LBUTTONUP, 0, 0);
end;
CodePudding user response:
Try BM_CLICK message, it should be the VCL message,CodePudding user response:
SendMessage (fu, WM_LBUTTONDOWN, 0, 0);SendMessage (fu, WM_LBUTTONUP, 0, 0);
The two sentences to:
SendMessage (fu, BM_CLICK, 0, 0);
Also I can't, master, thank you very much,
CodePudding user response:
SendMessage (fu, WM_LBUTTONDOWN, 1, and 65535 + x y SHL 16);//x, y is click position coordinates,CodePudding user response:
SetCursorPos (x, y);Mouse_event (MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0).
Mouse_event (MOUSEEVENTF_LEFTUP, 0, 0, 0, 0).
CodePudding user response:
I don't have to mouse_event, I need the background, mouse_event is only applicable to the front desk, but still thank you for your reply, thank you very much,CodePudding user response:
Background button to send the packet, send the packet function go into threadCodePudding user response:
Make sure you handle properly?CodePudding user response: