Skip to main content
gamedev.net
🔒 Locked

Tutorial for Loading an Icon

Started by Zeke 2 replies 500+ views
Original Post
Zeke
Zeke
Can anyone point me in the direction of how to Load an Icon for a window? Or just a general beginner windows programming tutorial. Thanks
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Shannon Barber
Shannon Barber
I think the api call is LoadIcon

http://msdn.microsoft.com/library/default.asp
Then click "Platform SDK"
Then "Win32 API"
Then "Reference"
Then "Functions by Category"
Then "Icon"

All the icon functions are there

-Magmai Kai Holmlor

I am brazen and fear no flames.
(So long as I don't lose this Ring of Fire Protection +5)
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
shawty
shawty
quote:
Original post by Zeke

Can anyone point me in the direction of how to Load an Icon for a window? Or just a general beginner windows programming tutorial.
Thanks




Loading an Icon for a window is quite easy, all you need to do is allocate it within the winmain function when you enter all the details in your class structure before passing the info onto create window, somthing along the following lines should do the trick.

HWND hWnd;
MSG lpMsg;
WNDCLASS wcApp;

wcApp.lpszClassName = szProgName;
wcApp.hInstance = hInst;
wcApp.lpfnWndProc = WndProc;
wcApp.hCursor = LoadCursor(NULL,IDC_ARROW);
wcApp.hIcon = <- Here is where you allocate
your icon, basicly you need
to use the Make Resource
Function to turn it into
a resource pointer from the
RC file linked with your
Project.
wcApp.lpszMenuName = 0;
wcApp.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wcApp.style = CS_HREDRAW/CS_VREDRAW;
wcApp.cbClsExtra = 0;
wcApp.cbWndExtra = 0;

if(!RegisterClass(&wcApp))
return 0;

If you need any more help, iv''e got a couple of full examples that iv''e written in MSVC6.0 with the project settings etc, e-mail me or ICQ me and i''ll send you them.




This is the Sound of

### # # ### # # ### # #
# # # # # # # # # # #
### #### ### # # # # ###
# # # # # # # # # #
### # # # # ##### # ##

Still Code Crazy, Best and only way to be!!
This is the Sound of ### # # ### # # ### # ## # # # # # # # # # #### #### ### # # # # ### # # # # # # # # # #### # # # # ##### # ##Still Code Crazy, Best and only way to be!!
Zeke
Zeke
Thanks guys I was following the TOTWGPG book and this is where i hit a hurdle but with your help I was able to load custom icons
Thanks again

Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.