How do I change the Icon on my exe?
Printable View
How do I change the Icon on my exe?
That's really more of a windows or tech board question.
hmmm...I guess it is...
Sorry.
Moved to the Windows forum (guessing that's where you want it ? )
Are you using visual studio? If so, just make an icon resource and when you register your class you can load it there. Look up MAKEINTRESOURCE
I think he's talking about changing the icon by command, after the program has been compiled... like some of the trojans.
Are you making some subtle hint Devil Panther?
Let's not jump to conclusions.Quote:
like some of the trojans
As for changing the icon during runtime, that should be possible somehow. A dodgy method of using WM_NCPAINT springs to mind. Of course, that's not REALLY changing the icon, just painting where it would be. And it would only paint one of the many application icons on the screen. Bah. Someone else?
hell no!
It's just really cool how some trojans can change their icon. But how do they do it... that's a mystery.
No Ideas? Drat.:(
Set the icon when you register the window class (see RegisterClassEx) or you can do it at runtime (eg for dialogs where you haven't registered a window class) with WM_SETICON (use SendMessage) or by using SetClassLong/SetClassLongPtr (GCL_HICON or GCL_HICONSM index). Search this board as this has been asked a number of times.
Yep, WM_SETICON works.
Code:HICON hIcon;
hIcon=LoadIcon(NULL,IDI_HAND);
SendMessage(hwnd,WM_SETICON,(WPARAM)ICON_SMALL,(LPARAM)hIcon);
SendMessage(hwnd,WM_SETICON,(WPARAM)ICON_BIG,(LPARAM)hIcon);
Ah, thanks. But I just found a way to do it with my compiler....