Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 06-15-2001, 10:03 PM
Kovachev Kovachev is offline
Member
 
Join Date: Mar 2001
Posts: 33
Default TImage / OnClick

There is a program that uses a TImage component as control
and has OnClick event. How could I simulate mouse click
from my program?

When there is TButton it has a THandle and I can use FindWindowEx and to get it Handle then with SendMessage
or PostMessage I can send WM_LBUTTONDOWN and WM_LBUTTONUP
to simulate mouse click. But the program I want to controw
is not written by me.

Please help me with this TImage.
Reply With Quote
  #2  
Old 06-15-2001, 10:24 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: TImage / OnClick

I have good news for you, though image is not a windows control like some other guys said, but our Delphi is more than a bunch of windows APIs, SHE's really POWERFUL! try this:

image1.perform(WM_LBUTTONDOWN,0, makelong(1, 1));
image1.perform(WM_LBUTTONUP,0, makelong(1, 1));
Reply With Quote
  #3  
Old 06-15-2001, 10:44 PM
Kovachev Kovachev is offline
Member
 
Join Date: Mar 2001
Posts: 33
Default RE: RE: TImage / OnClick

I sad that the program I whant to control is not written by me. I whant to conrtol net2phone program (it seems that it is written i Delphi or C++ Builder). And I need to press one TImage used as button but I can't enum. it.

P.S.:
If someone has some free time to look on this problem
I whant to click the CALL-button.
Reply With Quote
  #4  
Old 06-15-2001, 11:01 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: RE: RE: TImage / OnClick

well, I see, then use this code:

sendmessage(handle,WM_LBUTTONDOWN,0, makelong(x + 1 , y + 1));
sendmessage(handle,WM_LBUTTONUP,0, makelong(x + 1,y + 1));

handle: the image's parent form's handle(you should be able to get this handle, right?)
x,y: image's coordinates on the form(you may have to find out x and y, try saving the screen image and load it into some image editor to find out x, y)

I tried this code with no problem(one exception is that I know x, y)
Reply With Quote
  #5  
Old 06-15-2001, 11:07 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: RE: RE: RE: TImage / OnClick

I believe this mothod will work as long as that's an image not a win control, it has nothing to do with whether the program was written in Delphi or not.
Reply With Quote
  #6  
Old 06-15-2001, 11:19 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: RE: RE: RE: TImage / OnClick

I just think out another way to find out x,y, run net2phone first, run winsight32, check only WM_LBUTTONDOWN as to be spied, find window net2phone(follow focus? find window? not sure but it's there), check tracing selected window only option, then spy net2phone, click on the image, there should be one message in the result window, check its lParam, x, y are encoded there! makelong(x,y) = LParam.
Reply With Quote
  #7  
Old 06-16-2001, 06:40 AM
Tavares Tavares is offline
Senior Member
 
Join Date: Feb 2001
Posts: 1,318
Default RE: TImage / OnClick

Search for LMD Tools components.There is one component that allows you to put an image on it.

I Hope it helps you!

Regards,
Eduardo Tavares
www.tavareswebsite.cjb.net
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:11 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.