[HOTPLUG] Add title bar icon (#4695)

- Add small icon to the title bar
- Set large icon correctly

CORE-15445
This commit is contained in:
Thamatip Chitpong 2022-09-15 21:54:10 +07:00 committed by GitHub
parent cd6c7272a4
commit 474f406496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,8 @@
typedef struct _HOTPLUG_DATA
{
HICON hIcon;
HICON hIconSm;
SP_CLASSIMAGELIST_DATA ImageListData;
HMENU hPopupMenu;
DWORD dwFlags;
@ -372,6 +374,21 @@ SafeRemovalDlgProc(
SetWindowTextW(hwndDlg, szWindowTitle);
}
pHotplugData->hIcon = (HICON)LoadImageW(hApplet,
MAKEINTRESOURCEW(IDI_HOTPLUG),
IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
LR_DEFAULTCOLOR);
pHotplugData->hIconSm = (HICON)LoadImageW(hApplet,
MAKEINTRESOURCEW(IDI_HOTPLUG),
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
LR_DEFAULTCOLOR);
SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)pHotplugData->hIcon);
SendMessageW(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)pHotplugData->hIconSm);
pHotplugData->ImageListData.cbSize = sizeof(pHotplugData->ImageListData);
SetupDiGetClassImageList(&pHotplugData->ImageListData);
@ -472,6 +489,16 @@ SafeRemovalDlgProc(
SetupDiDestroyClassImageList(&pHotplugData->ImageListData);
if (pHotplugData->hIconSm)
{
DestroyIcon(pHotplugData->hIconSm);
}
if (pHotplugData->hIcon)
{
DestroyIcon(pHotplugData->hIcon);
}
HeapFree(GetProcessHeap(), 0, pHotplugData);
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)NULL);
}