Answered by:
Wrong Icon On Title Bar, revisited
Question
-
I'm developing a win32 application with Visual Studio 2008 on Windows Vista. I specify the iron resource in the resource file:
IDI_MEXPLORER ICON DISCARDABLE "..\\resource\\icon\\mexplorer.ico"However, I get a generic application icon on my title bar. What's weird is that it is ONLY in the title bar where I get the generic icon. In the taskbar, Windows explorer, and in the desktop shortcut, the icon is the correct one.
The code that load the icon is:
WNDCLASS wndclass;
hInst = hInstance;
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_MEXPLORER));
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = szAppName;
wndclass.lpszClassName = szAppName;Sunday, June 12, 2011 4:08 PM
Answers
-
-
use
wndclass.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_MEXPLORER));
instadeof
wndclass.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_MEXPLORER));
- Marked as answer by Leonard2007 Monday, June 13, 2011 3:03 PM
Monday, June 13, 2011 9:16 AM
All replies
-
I found a similar post at http://social.msdn.microsoft.com/forums/en-us/vcgeneral/thread/3126EA77-E27E-4CE8-AD4C-DED5D87B781C, but it is all about MFC.Sunday, June 12, 2011 4:09 PM
-
Try to send WM_SETICON message: http://msdn.microsoft.com/en-us/library/ms632643(VS.85).aspx.Sunday, June 12, 2011 5:57 PM
-
-
use
wndclass.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_MEXPLORER));
instadeof
wndclass.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_MEXPLORER));
- Marked as answer by Leonard2007 Monday, June 13, 2011 3:03 PM
Monday, June 13, 2011 9:16 AM -
Thank you all, it works.Monday, June 13, 2011 3:03 PM