Duilib modify the program exe, icon on the task bar and task manager

Reference: https://blog.csdn.net/Rongbo_J/article/details/47379997        https://www.cnblogs.com/happinessday/p/6369321.html

1. Open the Resource View, right-click on the Project => Add => Resources, open the Add Resource dialog box, choose Icon, click the button transferred, select Icon icon you want to import. (Note: 1 icon .ico file must be imported after import vs 2 will automatically generate a similar statement in resource.h in #define ID_ICON1 107 3. You write cpp file must contain resource.h)

2. Modify the resource ID. (Review: Switch to the resource view, just click on the file ico imported, then the view can be seen below the resource ID in the view may be by right clicking ico file, selecting Resource Symbols modified)

3. Call the Win32 API function LoadIcon, loading icon, the function returns a handle to an icon. (Statement IDI_ICON1 import ico file after you change the ID, if you have not changed, compared with the first step of automatically generated ID)

1 HICON hIcon = :: LoadIcon (hInst, MAKEINTRESOURCE (IDI_ICON1));

4. SendMessage function call to send a message STM_SETICON window.

1 ::SendMessage(wnd->GetHWND(),STM_SETICON,IMAGE_ICON,(LPARAM)(UINT)hIcon);

Add the above two statements in the statement after the Create function in WinMain

The function InitWindow OnCreate in the main window or file in the following code:

1 SetIcon(IDR_ICON1);

 

 

         

Guess you like

Origin www.cnblogs.com/Toya/p/11201155.html