[REGEDIT] Use shell icons for the tree view

- This makes regedit.exe smaller
- Reduces resource duplication in the source tree
- Potentially improves support for theming

CORE-10764
This commit is contained in:
Stanislav Motylkov 2022-11-03 01:38:05 +03:00
parent ed7b0d0bd9
commit 5daf5cd057
No known key found for this signature in database
GPG key ID: AFE513258CBA9E92
6 changed files with 21 additions and 21 deletions

View file

@ -33,9 +33,6 @@
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDI_OPEN_FILE ICON "res/folderopen.ico"
IDI_CLOSED_FILE ICON "res/folder.ico"
IDI_ROOT ICON "res/computer.ico"
IDI_STRING ICON "res/string.ico"
IDI_BIN ICON "res/bin.ico"
IDI_REGEDIT ICON "res/regedit.ico"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -40,9 +40,6 @@
#define IDC_REGEDIT_FRAME 110
#define IDR_REGEDIT_MENU 130
#define IDD_EXPORTRANGE 131
#define IDI_OPEN_FILE 132
#define IDI_CLOSED_FILE 133
#define IDI_ROOT 134
#define IDI_STRING 135
#define IDI_BIN 136
#define IDR_POPUP_MENUS 137

View file

@ -32,6 +32,11 @@ static LPWSTR pathBuffer;
#define NUM_ICONS 3
/* External resources in shell32.dll */
#define IDI_SHELL_FOLDER 4
#define IDI_SHELL_FOLDER_OPEN 5
#define IDI_SHELL_MY_COMPUTER 16
static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY* phKey, LPWSTR* pKeyPath, int* pPathLen, int* pMaxLen)
{
TVITEMW item;
@ -441,42 +446,43 @@ static BOOL InitTreeViewImageLists(HWND hwndTV)
HICON hico; /* handle to icon */
INT cx = GetSystemMetrics(SM_CXSMICON);
INT cy = GetSystemMetrics(SM_CYSMICON);
HMODULE hShell32 = GetModuleHandleW(L"shell32.dll");
/* Create the image list. */
if ((himl = ImageList_Create(cx, cy, ILC_MASK | ILC_COLOR32, 0, NUM_ICONS)) == NULL)
return FALSE;
/* Add the open file, closed file, and document bitmaps. */
hico = LoadImageW(hInst,
MAKEINTRESOURCEW(IDI_OPEN_FILE),
hico = LoadImageW(hShell32,
MAKEINTRESOURCEW(IDI_SHELL_FOLDER_OPEN),
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
0);
cx,
cy,
LR_DEFAULTCOLOR);
if (hico)
{
Image_Open = ImageList_AddIcon(himl, hico);
DestroyIcon(hico);
}
hico = LoadImageW(hInst,
MAKEINTRESOURCEW(IDI_CLOSED_FILE),
hico = LoadImageW(hShell32,
MAKEINTRESOURCEW(IDI_SHELL_FOLDER),
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
0);
cx,
cy,
LR_DEFAULTCOLOR);
if (hico)
{
Image_Closed = ImageList_AddIcon(himl, hico);
DestroyIcon(hico);
}
hico = LoadImageW(hInst,
MAKEINTRESOURCEW(IDI_ROOT),
hico = LoadImageW(hShell32,
MAKEINTRESOURCEW(IDI_SHELL_MY_COMPUTER),
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
0);
cx,
cy,
LR_DEFAULTCOLOR);
if (hico)
{
Image_Root = ImageList_AddIcon(himl, hico);