https://git.reactos.org/?p=reactos.git;a=commitdiff;h=474f406496dc80c3a8863…
commit 474f406496dc80c3a88634a1d89867472f86ddc8
Author: Thamatip Chitpong <tangaming123456(a)outlook.com>
AuthorDate: Thu Sep 15 21:54:10 2022 +0700
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Sep 15 17:54:10 2022 +0300
[HOTPLUG] Add title bar icon (#4695)
- Add small icon to the title bar
- Set large icon correctly
CORE-15445
---
dll/cpl/hotplug/hotplug.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/dll/cpl/hotplug/hotplug.c b/dll/cpl/hotplug/hotplug.c
index f3ee96ab694..da848bf2cbe 100644
--- a/dll/cpl/hotplug/hotplug.c
+++ b/dll/cpl/hotplug/hotplug.c
@@ -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);
}