View previous topic :: View next topic |
Author |
Message |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Fri Feb 27, 2009 10:35 am Post subject: [question] pressing an image (C++) |
|
|
how would i make an image on my form to become clickable?
i mean if i'll click it so some code will run...
|
|
Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Fri Feb 27, 2009 10:47 am Post subject: |
|
|
You might be able to use ChildWindowFromPoint.. If your using a static control for your image. If so try filterting WM_LBUTTONDOWN/UP and check if it works.
_________________
|
|
Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Fri Feb 27, 2009 11:49 am Post subject: |
|
|
yeah i tried filtering left button click but it failed
i first defined rectangle that contains the image coordinates
then checked if the cursor's position is somewhere at the rectangle's space
but what's the idea of using childwindowfrompoint ?
when will it be called ?
edit:
i think i got your idea
at the left button message i'll call this api with the current position of the cursor
and if it won't be null so it's at the image's space ?!
|
|
Back to top |
|
 |
iNoobHacker Advanced Cheater
Reputation: 0
Joined: 05 Nov 2006 Posts: 99
|
Posted: Fri Feb 27, 2009 12:27 pm Post subject: |
|
|
He meant that if you used a static control for your image you can use the ChildWindowFromPoint API.
You can simply do this when a WM_LBUTTONUP message arrives:
Code: | if (PtInRect(ImageRect, (POINT)lParam))
{
...
} |
|
|
Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Fri Feb 27, 2009 1:17 pm Post subject: |
|
|
awesome thx
didn't know about that api PtInRect
btw how would i change the icon of my executable file?
|
|
Back to top |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Fri Feb 27, 2009 1:36 pm Post subject: |
|
|
I think you can also place an image on a normal button control (You could use Styles to make the button edge not show) but I'm not sure. (Maybe that's VB or whatever)
For the icon: just include an icon in your resource file and it will automatically become your application's icon.
|
|
Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Fri Feb 27, 2009 2:11 pm Post subject: |
|
|
grate thx :]
|
|
Back to top |
|
 |
|