hIcon = LoadIcon(NULL,
MAKEINTRESOURCE(IDR_MAINFRAME));
Note that other resources like a dialog box, and the
accelerator table load just fine. Incidentally,
I am using a different entry point than WinMain to
make my program as small as possible. However after
switching back to use WinMain I had the same problem.
GetLastError gives error code 1814, which is described here:
1814 The specified resource name cannot be found in the image file.
ERROR_RESOURCE_NAME_NOT_FOUND
The icon with the symbol IDR_MAINFRAME IS in the image file --
that is of course the resource file, so this error code does not
make any sense to me.
Any ideas on how to troubleshoot this further? I get precisely the
same error when I call ::FindResource instead of ::LoadIcon.
I can see no reason whatsoever why this icon should not be loading.
The icon is in the resource file, and other resources load without any
problem.
Thanks,
Robert Paul Dyer
.
You say the icon exists, Windows says it does not. The only way you can both
be write in a rational world is if IDR_MAINFRAME is different in your source
than in the resource script.
I think it is politically incorrect but I detest the MAKEINTRESOURCE()
macro. I always name the resources and pass string names to the function.
Regards,
Will
Hope this helps
Jamie O'Brien
jam...@interworx.com.au
Robert Paul Dyer wrote in message <35F6E4C9...@pobox.com>...
>When I attempt to load an icon from the resource file
>using the Win32 function ::LoadIcon, it fails. I use
>this code for the function call:
>
> hIcon = LoadIcon(NULL,
> MAKEINTRESOURCE(IDR_MAINFRAME));
>
>Note that other resources like a dialog box, and the
>accelerator table load just fine. Incidentally,
>I am using a different entry point than WinMain to
>make my program as small as possible. However after
>switching back to use WinMain I had the same problem.
>
>GetLastError gives error code 1814, which is described here:
>
>1814 The specified resource name cannot be found in the image file.
>ERROR_RESOURCE_NAME_NOT_FOUND
>