Search code examples
winapiiconsuser32loadimage

How do I use one of the standard windows icons via the Win32 API?


For an app-supplied icon I know I can use LR_LOADFROMFILE, LR_DEFAULTSIZE flags with user32.LoadImageA, but for now I want to use one of the standard windows supplied ones, I think they live in a win32 dll somewhere (maybe user32 itself).

How do I use one of the standard windows icons via the Win32 API?


Solution

  • Call LoadIcon to load one of the standard icons. You must pass NULL as the instance and the one of the predefined values IDI_ERROR, IDI_QUESTION, etc. See the documentation for the full list.