the MSDN library is also available online:
http://msdn.microsoft.com/library/default.asp
Printable View
the MSDN library is also available online:
http://msdn.microsoft.com/library/default.asp
Wasnt actually of my application, but of one specific window.. I mean so that a window has got an icon located: F:\Icons\Main.ico
Thanks :)
Well, if you haven't created the icon as a resource then you probably have to load the icon at runtime.
You could do this by processing the WM_CREATE message in your windows procedure function. (I am assuming we are talking windows here and not console.. :) )
This following code when processed after a WM_CREATE message from the windows message loop will load a .ico file and use it as an icon. Note that this code only loads the 32x32 version of the icon - You will need to execute it again for the 16x16 size. (and make sure you get another handle to the smaller icon.. i.e. hIconSm). This in effect sets the values of wc.hIcon and wc.hIconSm in your windows class. (Assuming you have called your windows class wc).
Hope this makes sense, this is a bit rushed. :)Code:HICON hIcon;
hIcon = LoadImage(NULL, "Icon.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);
if(hIcon)
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
else
MessageBox(hwnd, "Couldn't load icon!", "ERROR!", MB_OK | MB_ICONERROR);
Oh - if you don't know, the 32x32 icon is used when your program is minimised in the task bar, the 16x16 icon is located in the top left corner of your program. So, concievably you could have two completely different icons if you so chose!
Ok, I'll try it :)
http://winprog.org/tutorial/menus.html
Actually just had a look at my example, and I haven't done everything that you require... Have a look at this example - or have a look at Charles Petzolds book "Programming Windows". Excellent tuts in that.
If you aren't clear on anything, just post again with some code.
Thanks, I'll check it out :)