I am trying to load an icon I created for my program. Relevant code is below:
Code:
//resource.h
#define IDR_MYMENU 103
#define IDR_MYICON 201
#define ID_HELP_NOTICE 40001
#define ID_HELP_ERROR 40002
#define ID_FILE_EXIT 40003
//the .rc file
IDR_MYMENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Exit", ID_FILE_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&Developer Notice", ID_HELP_NOTICE
MENUITEM "&Error Codes", ID_HELP_ERROR
END
END
IDI_MYICON ICON "myIcon.ico"
//the section of code in the WINAPI function where I'm defining my window (WNDCLASSEX wc;)
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszClassName = g_szClassName;
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MYMENU);
//wc.hIcon = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MYICON));
wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MYICON), IMAGE_ICON, 16, 16, 0);
if(!wc.hIconSm)
MessageBox(NULL, L"Icon Registration Failed!", L"Error!",
MB_ICONEXCLAMATION | MB_OK);
//creating the actual window
hwnd = CreateWindowEx(
WS_EX_CLIENTEDGE,
g_szClassName,
L"Pandect - In Development",
WS_OVERLAPPEDWINDOW | SB_LINEUP | SB_LINEDOWN | ES_MULTILINE |
WS_HSCROLL | WS_VSCROLL,
CW_USEDEFAULT, CW_USEDEFAULT, 1024, 768,
NULL, NULL, hInstance, NULL);
For some reason, the icon fails to load. I ran a breakpoint at the line for the hIconSm and got this error for the variable:
Code:
CXX0030: Error: expression cannot be evaluated
The icon image is in the source folder and was compiled via ImageMagick. Google is not giving me any info regarding the error and the icon combined. Is there even a solution to this?