On Sunday, 5 January 2020 at 15:13:17 UTC, Rumbu wrote:
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.

Very good! working using: LoadIcon(hInstance, MAKEINTRESOURCE(youriconid)); becouse GetModuleHandle(NULL) is undefined here.

Reply via email to