-
Icon? help!
I can't seem to get this whole icon thing down. I'm using Dev C++
Here's what I'm doing.
I go to new. Start a new project as a "windows application".
I go into "project options" and change the icon to the one of my choice. This creates the icon that shows up on the exe.
(My icon is named 500 in my resource by default.)
I just can't get the little icon in the toolbar or the icon in the titlebar of the program to change!
This is sure to have something to do with it...
wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
Any help would be greatly appreciated!
-
Update!
Here's what I did to get it working!
I changed these...
wincl.lpszMenuName = NULL;
wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
to these...
wincl.lpszMenuName = MAKEINTRESOURCE(IDR_MYMENU);
wincl.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON));
wincl.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 16, 16, 0);
and added...
#include "resource.h"
to the top of the program code
(right under #include <windows.h>)
Then I added a file called resource.h to my project by right clicking on Project 1 (in the project manager) and selecting "new unit in project".
I typed just this into it...
#define IDR_MYMENU 101
#define IDI_MYICON 201
Then saved unit as resource.h.
(Be sure to save the file type as "Header file (*.h)" in the drop down box.)
Then added these to the top of the resource file (rsrc.rc)...
#include <windows.h>
#include "resource.h"
IDI_MYICON ICON "c:/My Documents/menu_one.ico"
Your icon may be named something other than menu_one.ico, change accordingly.
and BAM!
all done!
Much thanks to "TheForger" at winprog.org for writing the help page I used. Found here...
http://www.winprog.org/tutorial/menus.html:D