How load icon from resource using LoadImage?
Rumbu
rumbu at rumbu.ro
Sun Jan 5 15:13:17 UTC 2020
On Sunday, 5 January 2020 at 13:33:35 UTC, Marcone wrote:
> I am using this code to load icon from local directory, but I
> want to load icon from resource.res file:
>
> wndclass.hIcon = LoadImage( NULL, "icon.ico", IMAGE_ICON, 0,
> 0, LR_LOADFROMFILE| LR_SHARED | LR_LOADTRANSPARENT);
You cannot load icons from res files.
If you link your res file to the executable, you can load the
icon using:
LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(youriconid));
The function LoadImage from above loads an icon from the file
named icon.ico, not from a res file.
More information about the Digitalmars-d-learn
mailing list