How to Simulate a mouse move in code?



How to Simulate a mouse move in code?..

Answer / Alok Deep Satwalia

In Delphi, you can use the TWinControl.PostMessage method with the WM_MOUSEMOVE message to simulate a mouse move programmatically. Here's a simple example:nn```delphin// Get the current position of the form (or any other control)
var
ptForm: TPoint;
begin
// Set the new position for the mouse cursor
ptForm.X := 100;
ptForm.Y := 200;

// Send the WM_MOUSEMOVE message to move the mouse cursor to the new position
SendMessage(Handle, WM_MOUSEMOVE, 0, MakeLongInt(ptForm.X, ptForm.Y));
end;n``

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Delphi Interview Questions

How to Get user name and company info from Windows?

1 Answers  


What are the different ways of defining array sizes?

1 Answers  


How to Display a bitmap on the client area of an MDI parent form?

1 Answers  


How to detect the computer name?

1 Answers   Sr Comunications,


why Paradox slow on some computers and not on others ?

1 Answers  


What is Delphi/400 Client Server Suite?

1 Answers   Delphi, IBM,


How to Disable system menu in code?

1 Answers  


What directory is the ActiveForm in ?

1 Answers  


Are there any tools to help me migrate my applications to Delphi?

1 Answers  


How to Change the main form of an application at runtime ?

1 Answers  


How to create an example of your problem for Borland Developer Support?

1 Answers  


Explain the findfirst method?

1 Answers  


Categories