1. hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON1))
- With NULL as the first parameter, the LoadIcon function tries to load a standard windows icon.
If you want to load an icon from your resource you have to provide the HINSTANCE handle of your
program.
The BeginPaint and Endpaint functions should only be used in conjunction with a WM_PAINT message.
Use the GetDC and ReleaseDC functions when painting outside of a WM_PAINT message handler.
(*But if you want the icon to stay onscreen- you may want to consider moving code into the WM_PAINT handler*).
*EDIT*
This should really have been in the Windows forum