The
LoadImage()
function gives an error but you did not check if an error occured (if the returned handle is NULL). Read the documentation:
LoadImageA function | Microsoft Docs[
^].
If you want to load an image or icon from the resources embedded in your executable, you have to pass the ID using
MAKEINTRESOURCE
and don't use
LR_LOADFROMFILE
:
HICON h_Ico = (HICON) LoadImage( AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 32, 32, 0 );
if (h_Ico == NULL)
{
}