Problems with setting application icon

前端 未结 5 1905
伪装坚强ぢ
伪装坚强ぢ 2021-01-05 14:53

(I\'m using Visual Studio 2008, though I remember having similar problems with older versions as well.)

I\'ve tried several different methods (many of them mentioned

5条回答
  •  暖寄归人
    2021-01-05 15:26

    OK, this worked a treat for me :

    HICON hIconSmall =(HICON)LoadImage(handleToYourApplicationInstance, MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON,16, 16, 0);
    
    HICON hIconLarge =(HICON)LoadImage(handleToYourApplicationInstance, MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON,256, 256, 0); // Big for task bar, small loaded otherwise.
    
    SendMessage(yourWindowHandle, WM_SETICON, ICON_SMALL, (LPARAM)hIconSmall) ;
    
    SendMessage(yourWindowHandle, WM_SETICON, ICON_BIG, (LPARAM)hIconLarge) ;
    

提交回复
热议问题