I know I can import icons into my Visual C++ project, but how do I define the icon to be represented with the exe-file.
My program is just a WIN32 application without MFC.
Thanks in advance
I know I can import icons into my Visual C++ project, but how do I define the icon to be represented with the exe-file.
My program is just a WIN32 application without MFC.
Thanks in advance
The application icon is the first icon in the resources.
Ess
Like a rat in a maze who says,
"Watch me choose my own direction"
Are you under the illusion
The path is winding your way? - Rush
Thanks, but I knew that already.
What I was looking for is if it is possible to define the exe-icon from the list of icons in the resource?
For instance: I have 3 icons in the list and I want to define icon 2 as the exe-icon.
Is this what you are looking for
when you register your window class:
wndclass.hIcon= LoadIcon(NULL,MAKEINTRESOURCE(IDI_ICON2));
this will load the icon for the exe file
BTW:tof om hier nog nen Belg tegen te komen.
Could that work?
You've written some code that is executed when the exe is running.
Logically the exe is build before you run it. So the visible exe-icon can't logically be defined in the code.
I'm looking for is some sort of projectsetting to define the visible exe-icon.
Hi
You can play with the ID's of the icons.
The one with the smallest ID will be used as icon for the EXE
don't forget to rebuild all the project when you change the ID's in your 'resource.h' file.
example:
#define IDR_MAINFRAME 128
#define IDI_ICON1 129
#define IDI_ICON2 130
will assign the first as 'icon for the exe'
#define IDI_ICON1 1
will assign that icon for the EXE
damyan
Thanks!
That was exactly what I was looking for!
>>when you register your window class:
>>wndclass.hIcon=LoadIcon(NULL,MAKEINTRESOURCE(IDI _ICON2));
This works for me. The exe has this icon instead of the standard windows .exe or .com icon. (I only have one icon so....)
To set an icon for a window or dialog box (displayed in next to the title).
SetClassLong(hWnd,GCL_HICON,(LONG) LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1)));