?
Solved

Mouse Click

Posted on 2000-03-24
5
Medium Priority
?
159 Views
Last Modified: 2010-04-04
How can i make the mouse do the event click at runtime from my code ?
0
Comment
Question by:crazydragonx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 6

Expert Comment

by:Jaymol
ID: 2652481
What do you want to click?  Most objects have a click event that you can trigger.  (Button1.Click for example)

John.
0
 
LVL 12

Expert Comment

by:Faruk Onder Yerli
ID: 2652528
you can listen windows messaging .
0
 
LVL 17

Accepted Solution

by:
inthe earned 150 total points
ID: 2652548
can do :

sendmessage(handle_of _what_to_click,WM_LBUTTONDOWN,0,0);
sendmessage(handle_of _what_to_click,WM_LBUTTONUP,0,0);

or

sendmessage(handle_what_to_click,bm_click,0,0);
0
 

Expert Comment

by:sywhc
ID: 2652552
button1.Perform(WM_LBUTTONDOWN,-1,0 );
0
 

Expert Comment

by:vinnair
ID: 2652591
I assume you want the mouse click event to trigger at runtime.

For that the clicking event should occur upon some parent object like a form or a button.

In case of a button it is easy to invoke the mouse click event at runtime. It can be done by calling the click procedure for the button. thus just a single statement:
  button1.click
would do the trick.

In case of a form it is a bit different from the button. Nevertheless this is also quite easy to do:

  form1.formclick(application)
would do the job.

To invoke any event as such is easy:

If say 'OnClick(Sender: TObject)' was an event of object 'Object1'. You can at runtime or designtime associate a procedure with the event which will be executed when the event is invoked. At designtime it is quite simple. At runtime it can be done as follows:

Object1.OnClick := Object1click.

Note that the parameters of the event and the procedure must match.

This was on how to associate a procedure with the event.

Now to invoke the event at runtime the code is quite simple. It is as follows:

If Assigned(Object1.OnClick) do
  Object1.OnClick(application);

This way any event can be invoked at runtime, let alone the mouse click event.

I hope the above solves your problem.
Best of luck!



0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question