|
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ShowMessage("Button 1 clicked");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Application->ProcessMessages();
// Get the point in the center of button 1
TPoint Pt;
Pt.x = Button1->Left + Button1->Width / 2;
Pt.y = Button1->Top + Button1->Height / 2;
// Convert Pt to screen coordinates
Pt = ClientToScreen(Pt);
// Convert Pt to mickeys
Pt.x = Pt.x * 65535. / Screen->Width;
Pt.y = Pt.y * 65535. / Screen->Height;
// Move the mouse
mouse_event(MOUSEEVENTF_ABSOLUTE : MOUSEEVENTF_MOVE, Pt.x, Pt.y, 0, 0);<<======여기서
function call error
// Simulate the left mouse button down
mouse_event(MOUSEEVENTF_ABSOLUTE : MOUSEEVENTF_LEFTDOWN, Pt.x, Pt.y, 0, 0);
// Simulate the left mouse button up
mouse_event(MOUSEEVENTF_ABSOLUTE : MOUSEEVENTF_LEFTUP, Pt.x, Pt.y, 0, 0);
}
|