-
March 27th, 2006, 08:02 AM
#1
Insert an icon at the place where i right click in the window
Hi I have a class inherited from CCmdTarget which handles the right click event.when user select a choice from context menu then i have to show an icon at that window. plz help me.
-
March 27th, 2006, 08:26 AM
#2
Re: Insert an icon at the place where i right click in the window
How do you store the icons?? Do you need more then one icon to draw. I ask that because you can store in a CImageList and draw it by specifying the index
Code:
BOOL Draw( CDC* pDC, int nImage, POINT pt, UINT nStyle );
or if you don't like that way get the icon handle and draw it on the screen with this function:
Code:
BOOL DrawIcon(int x,int y,HICON hIcon );
Please use code tags [code] [/code]
We would change the world, but God won't give us the sourcecode..
Undocumented futures are fun and useful....
_________
Gili
-
March 27th, 2006, 08:57 AM
#3
Re: Insert an icon at the place where i right click in the window
I have only a single icon with me. how the application will identify x and y.
-
March 27th, 2006, 09:01 AM
#4
Re: Insert an icon at the place where i right click in the window
Originally Posted by chetan_mnit2003
I have only a single icon with me. how the application will identify x and y.
you should get the x/y coordinates with the right-click window message. you could probably give a little more detail on your application or post some code, i'm sure someone can help you.
btw: did you inherit directly from CCmdTarget? you should probably use CWnd or so as your base class, because i'm not sure if CCmdTarget offers a graphics context to draw the icon in.
Last edited by reset-leo; March 27th, 2006 at 09:04 AM.
-
March 27th, 2006, 09:04 AM
#5
Re: Insert an icon at the place where i right click in the window
You have to specify the x and the y coordinates...
Please use code tags [code] [/code]
We would change the world, but God won't give us the sourcecode..
Undocumented futures are fun and useful....
_________
Gili
-
March 27th, 2006, 09:06 AM
#6
Re: Insert an icon at the place where i right click in the window
how can i get handle for the icon(HICON) because loadicon takes two parameters (HWND, Name) and i dont have HWND.
-
March 27th, 2006, 09:19 AM
#7
Re: Insert an icon at the place where i right click in the window
Try this
Code:
HICON hIcon=AfxGetApp()->Loadicon(IDI_YOURICON);
Please use code tags [code] [/code]
We would change the world, but God won't give us the sourcecode..
Undocumented futures are fun and useful....
_________
Gili
-
March 27th, 2006, 11:15 PM
#8
Re: Insert an icon at the place where i right click in the window
Draw Icon takes CDC parameter. i have to show this icon on activeX control.so how can i take CDC for ActiveX Control.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|