How would you get a handle to an icon so you can use it in the SendMessage() function set an icon on a console application?
Quote from: Mephisto on September 26, 2004, 06:10 PM
How would you get a handle to an icon so you can use it in the SendMessage() function set an icon on a console application?
See WM_GETICON.
That's for getting an icon from the window associated with it isn't it? I need a method for getting a handle to an icon via the file name if this is possible.
HICON hIcon = ExtractIcon((HINSTANCE)GetModuleHandle(NULL),(char*)"filepath\icofile.ico",0);
Would this be what you want?
Quote from: dRAgoN on September 26, 2004, 08:33 PM
HICON hIcon = ExtractIcon((HINSTANCE)GetModuleHandle(NULL),(char*)"filepath\icofile.ico",0);
Would this be what you want?
I already tried using that function earlier. It needs to be the same type as the SetMessage function; typecasting doesn't seem to work. Lookup WM_SETICON, and maybe you can tell me from looking at the required arguments.
Use LoadIcon if the icon is compiled into your executable.