changing icon in win32 during runtime

Started by
3 comments, last by Colin Jeanne 19 years, 3 months ago
Hi how do I change the icon in the title bar. I have a custom window class that creates a window with the default IDI_APPLICATION icon. I want to inherit the class and then be able to change the icon. I looked at msdn and it said to do this.

void Icon(int icon)
{
   SetClassLongPtr(m_hWnd, GCL_HICON, 
	(LONG)LoadIcon(m_hInst, MAKEINTRESOURCE(icon)));
}


But it doesn't change, is there something I am missing.
Advertisement
I think the icon on the title bar is the small icon, which should be GCLP_HICONSM instead of GCL_HICON
so what does GCL_HICON change?
GCL_HICON changes the big icon, the ones on the program list when you do an alt-tab.
Dont you think it would just be easier to use WM_SETICON? Example here

This topic is closed to new replies.

Advertisement