load icon with mfc
hello, i want to do an editor for my game in msvc++ 5 with mfc. i created a win32 application and configurated it lo link dynamically with mfc. i derived a class from CWinApp and a class from CFrameWnd and all goes well. but now i want to change the icon that is in the top left corner of my window, i dont have no idea how to do this. i searched in the class members of CFrameWnd and CWnd and I didnt see nothing to do it. but, i founded a function that is named LoadIcon in the class members of CWinApp class and i tried it but it just load the icon in memory and returns an handle to it...
anyone have an idea of how to do it???
cyberg
cyberg- cyberg_coder@hotmail.com- http://members.xoom.com/cybergsoft
please someone, help me if you know how...
cyberg- cyberg_coder@hotmail.com- http://members.xoom.com/cybergsoft
This might seem stupid but because I had a similar problem, I will tell you my similar solution
I couldn''t change the icon on the top left because the one I edited in the resource editor was the one of size 32*32 pixel
So if you go in the Icon folder of the resources select the icon small (from the combo box in visual C++) and select small 16*16 instead, the editing you will do to that Icon will appear at the top left of the main window of your application.
Hope it helped
Benjoun
I couldn''t change the icon on the top left because the one I edited in the resource editor was the one of size 32*32 pixel
So if you go in the Icon folder of the resources select the icon small (from the combo box in visual C++) and select small 16*16 instead, the editing you will do to that Icon will appear at the top left of the main window of your application.
Hope it helped
Benjoun
Benjoun
Make sure the application icon is named:
IDR_MAINFRAME -- Both the 32x32 and 16x16
Also you can do this in the CWinApp::InitInstance()
YAP-YFIO,
deadlinegrunt
IDR_MAINFRAME -- Both the 32x32 and 16x16
Also you can do this in the CWinApp::InitInstance()
m_pMainWnd->SetIcon( ::LoadIcon( this->m_hInstance, MAKEINTRESOURCE( IDI_ICON1 ) ), true ); // Or change true to false, tell you what -- you look in MSDN...
YAP-YFIO,
deadlinegrunt
~deadlinegrunt
The methods listed will work... but let me tell you about a spiffy little thing that you might find useful in the future.
Bring up an icon in your resource editor. See the combobox just above it labelled "Device"? That''s the device context for your icon. Most of your IDR_MAINFRAME icons will have two of these, the 32x32 one and the 16x16 one. Your app will pick the one it needs to use.
No 16x16 in the combobox? Go to Image->New Device Image. There you''ll have a list of "normal" ones to use for your resource, as well as a "custom" button which lets you define your own.
Now for the reason this is so spiffy...
It lets you make color cursors. Cool huh... especially for games. Do your Image->New Device Image thing (because "normal" cursors only have one "default" context, which is 32x32 monochrome) and make a custom cursor. Make it as big and colorful as you want. You can have up to 256 colors, more are prohibited mostly due to the fact that 256 is guaranteed compatible with all windows systems pretty much.
Enjoy!
-fel
Bring up an icon in your resource editor. See the combobox just above it labelled "Device"? That''s the device context for your icon. Most of your IDR_MAINFRAME icons will have two of these, the 32x32 one and the 16x16 one. Your app will pick the one it needs to use.
No 16x16 in the combobox? Go to Image->New Device Image. There you''ll have a list of "normal" ones to use for your resource, as well as a "custom" button which lets you define your own.
Now for the reason this is so spiffy...
It lets you make color cursors. Cool huh... especially for games. Do your Image->New Device Image thing (because "normal" cursors only have one "default" context, which is 32x32 monochrome) and make a custom cursor. Make it as big and colorful as you want. You can have up to 256 colors, more are prohibited mostly due to the fact that 256 is guaranteed compatible with all windows systems pretty much.
Enjoy!
-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
You do not even need the 16x16 icon, as windows will resize the 32x32 image automatically
When I find my code in tons of trouble,Friends and colleages come to me,Speaking words of wisdom:"Write in C."My Web Site
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement