Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Loading Icon

Status
Not open for further replies.

Milby7

Programmer
Dec 5, 2003
67
GB
I'm pretty new to win32 gui stuff & am having real problems loading an icon into a window. Can anyone see anything wrong with the code below?

Code:
hFileIcon = (HICON) LoadImage(NULL,
			  _T("c:\\test.ico"),					  IMAGE_ICON,						  0,							  0,							  LR_DEFAULTSIZE | LR_LOADFROMFILE);

hOldIcon = (HICON) SetClassLong(hWnd, GCL_HICON, (LONG) hFileIcon);
// (SetClassLong returns 0 & GetLastError returns 6: The handle is invalid.)
...
...
...


Many thanks!

 
Sorry about the above, this code's a bit easier to read. :eek:)

Code:
hFileIcon = (HICON) LoadImage(NULL,  _T("c:\\test.ico"), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE);

hOldIcon = (HICON) SetClassLong(hWnd, GCL_HICON, (LONG) hFileIcon);
// (SetClassLong returns 0 & GetLastError returns 6: The handle is invalid.)
...
...
...


Many thanks!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top