8bc474c462
Improve DirectComposition menu cancellation and shadow behavior, apply suggested window bounds on DPI changes, and process queued main-thread invokes in order. Also centralize window-overlap detection, harden composition-attribute lookup, and register search filters only after the search box is created.
1808 lines
49 KiB
C
1808 lines
49 KiB
C
/*
|
|
* Copyright (c) 2022 Winsider Seminars & Solutions, Inc. All rights reserved.
|
|
*
|
|
* This file is part of System Informer.
|
|
*
|
|
* Authors:
|
|
*
|
|
* dmex 2011-2026
|
|
*
|
|
*/
|
|
|
|
#include "toolstatus.h"
|
|
|
|
SIZE ToolBarImageSize = { 16, 16 };
|
|
HIMAGELIST ToolBarImageList = NULL;
|
|
HFONT ToolbarWindowFont = NULL;
|
|
BOOLEAN ToolbarInitialized = FALSE;
|
|
ULONG ToolbarSearchRebarIndex = ULONG_MAX;
|
|
TBBUTTON ToolbarButtons[MAX_TOOLBAR_ITEMS] =
|
|
{
|
|
// Default toolbar buttons (displayed)
|
|
{ I_IMAGECALLBACK, PHAPP_ID_VIEW_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
{ I_IMAGECALLBACK, PHAPP_ID_HACKER_OPTIONS, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
{ 0, 0, 0, BTNS_SEP, { 0 }, 0, 0 },
|
|
{ I_IMAGECALLBACK, PHAPP_ID_HACKER_FINDHANDLESORDLLS, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
{ I_IMAGECALLBACK, PHAPP_ID_VIEW_SYSTEMINFORMATION, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
{ 0, 0, 0, BTNS_SEP, { 0 }, 0, 0 },
|
|
{ I_IMAGECALLBACK, TIDC_FINDWINDOW, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
{ I_IMAGECALLBACK, TIDC_FINDWINDOWTHREAD, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
{ I_IMAGECALLBACK, TIDC_FINDWINDOWKILL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
{ 0, 0, 0, BTNS_SEP, { 0 }, 0, 0 },
|
|
{ I_IMAGECALLBACK, PHAPP_ID_HACKER_SHOWDETAILSFORALLPROCESSES, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
// Available toolbar buttons (hidden)
|
|
{ I_IMAGECALLBACK, PHAPP_ID_VIEW_ALWAYSONTOP, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
{ I_IMAGECALLBACK, TIDC_POWERMENUDROPDOWN, TBSTATE_ENABLED, BTNS_WHOLEDROPDOWN | BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
{ I_IMAGECALLBACK, TIDC_FINDDIALOG, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT, { 0 }, 0, 0 },
|
|
};
|
|
|
|
/**
|
|
* Creates a toolbar window.
|
|
*
|
|
* \param ParentWindowHandle A handle to the parent window.
|
|
* \return A handle to the created toolbar window.
|
|
*/
|
|
HWND ToolbarCreateWindow(
|
|
_In_ HWND ParentWindowHandle
|
|
)
|
|
{
|
|
HWND toolbarHandle;
|
|
RECT toolbarRect;
|
|
|
|
ToolStatusGetBarWindowRect(ParentWindowHandle, FALSE, &toolbarRect);
|
|
|
|
toolbarHandle = PhCreateWindowEx(
|
|
TOOLBARCLASSNAME,
|
|
NULL,
|
|
WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER |
|
|
TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE,
|
|
WS_EX_TOOLWINDOW,
|
|
toolbarRect.left,
|
|
toolbarRect.top,
|
|
toolbarRect.right - toolbarRect.left,
|
|
toolbarRect.bottom - toolbarRect.top,
|
|
ParentWindowHandle,
|
|
NULL,
|
|
NULL,
|
|
NULL
|
|
);
|
|
|
|
// Set the toolbar struct size.
|
|
SendMessage(toolbarHandle, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
|
// Set the toolbar extended toolbar styles.
|
|
SendMessage(toolbarHandle, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DOUBLEBUFFER | TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_HIDECLIPPEDBUTTONS);
|
|
SendMessage(toolbarHandle, TB_SETMAXTEXTROWS, 1, 0);
|
|
SendMessage(toolbarHandle, TB_SETBUTTONWIDTH, 0, MAKELONG(0, 200));
|
|
|
|
return toolbarHandle;
|
|
}
|
|
|
|
/**
|
|
* Creates a rebar window.
|
|
*
|
|
* \param ParentWindowHandle A handle to the parent window.
|
|
* \return A handle to the created rebar window.
|
|
*/
|
|
HWND RebarCreateWindow(
|
|
_In_ HWND ParentWindowHandle
|
|
)
|
|
{
|
|
HWND rebarHandle;
|
|
RECT rebarRect;
|
|
|
|
ToolStatusGetBarWindowRect(ParentWindowHandle, FALSE, &rebarRect);
|
|
|
|
rebarHandle = PhCreateWindow(
|
|
REBARCLASSNAME,
|
|
NULL,
|
|
WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NODIVIDER | CCS_TOP | RBS_VARHEIGHT,
|
|
rebarRect.left,
|
|
rebarRect.top,
|
|
rebarRect.right - rebarRect.left,
|
|
rebarRect.bottom - rebarRect.top,
|
|
ParentWindowHandle,
|
|
NULL,
|
|
NULL,
|
|
NULL
|
|
);
|
|
|
|
RebarSetBarInfo();
|
|
|
|
return rebarHandle;
|
|
}
|
|
|
|
/**
|
|
* Updates the toolbar window font.
|
|
*/
|
|
VOID ToolbarUpdateFont(
|
|
VOID
|
|
)
|
|
{
|
|
ToolbarWindowFont = SystemInformer_GetFont();
|
|
}
|
|
|
|
/**
|
|
* Updates the toolbar image list.
|
|
*
|
|
* \param DpiChanged Whether the DPI has changed.
|
|
*/
|
|
VOID ToolbarUpdateImageList(
|
|
_In_ BOOLEAN DpiChanged
|
|
)
|
|
{
|
|
if (!ToolBarImageList || DpiChanged)
|
|
{
|
|
LONG windowDpi = SystemInformer_GetWindowDpi();
|
|
|
|
if (ToolStatusConfig.ToolBarLargeIcons)
|
|
{
|
|
ToolBarImageSize.cx = PhGetSystemMetrics(SM_CXICON, windowDpi);
|
|
ToolBarImageSize.cy = PhGetSystemMetrics(SM_CYICON, windowDpi);
|
|
}
|
|
else
|
|
{
|
|
ToolBarImageSize.cx = PhGetSystemMetrics(SM_CXSMICON, windowDpi);
|
|
ToolBarImageSize.cy = PhGetSystemMetrics(SM_CYSMICON, windowDpi);
|
|
}
|
|
|
|
if (ToolBarImageList)
|
|
{
|
|
PhImageListSetIconSize(ToolBarImageList, ToolBarImageSize.cx, ToolBarImageSize.cy);
|
|
}
|
|
else
|
|
{
|
|
ToolBarImageList = PhImageListCreate(
|
|
ToolBarImageSize.cx,
|
|
ToolBarImageSize.cy,
|
|
ILC_MASK | ILC_COLOR32,
|
|
MAX_DEFAULT_TOOLBAR_ITEMS,
|
|
MAX_DEFAULT_IMAGELIST_ITEMS
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
VOID ToolbarUpdateWindowStyle(
|
|
VOID
|
|
)
|
|
{
|
|
if (!ToolBarHandle)
|
|
return;
|
|
|
|
//PhSetWindowStyle(
|
|
// ToolBarHandle,
|
|
// TBSTYLE_TRANSPARENT,
|
|
// EnableThemeSupport ? 0 : TBSTYLE_TRANSPARENT
|
|
// );
|
|
|
|
//InvalidateRect(ToolBarHandle, NULL, TRUE);
|
|
}
|
|
|
|
/**
|
|
* Retrieves the toolbar button (and band child) height for the current font and DPI.
|
|
* Other bands on the toolbar row use this instead of the current row height, which
|
|
* is stale after a DPI or font change and would keep the row from shrinking.
|
|
*
|
|
* \return The height, or 0 if the toolbar doesn't exist.
|
|
*/
|
|
LONG ToolbarGetCommandBarButtonHeight(
|
|
VOID
|
|
)
|
|
{
|
|
LONG dpiValue;
|
|
LONG buttonHeight;
|
|
LONG contentHeight;
|
|
|
|
if (!ToolBarHandle)
|
|
return 0;
|
|
|
|
dpiValue = PhGetWindowDpi(ToolBarHandle);
|
|
buttonHeight = PhScaleToDisplay(24, dpiValue);
|
|
contentHeight = ToolBarImageSize.cy + PhScaleToDisplay(4, dpiValue);
|
|
|
|
if (ToolbarWindowFont)
|
|
contentHeight = __max(contentHeight, ToolStatusGetWindowFontSize(ToolBarHandle, ToolbarWindowFont));
|
|
|
|
return __max(buttonHeight, contentHeight);
|
|
}
|
|
|
|
VOID ToolbarUpdateBandSize(
|
|
VOID
|
|
)
|
|
{
|
|
BAND_CHILD_SIZE bandSize;
|
|
ULONG toolbarButtonSize;
|
|
ULONG toolbarIndex;
|
|
LONG buttonHeight;
|
|
LONG bandChildHeight;
|
|
LONG commandBarHeight;
|
|
LONG dpiValue;
|
|
|
|
if (!ToolBarHandle || !RebarHandle)
|
|
return;
|
|
|
|
toolbarIndex = RebarBandToIndex(REBAR_BAND_ID_TOOLBAR);
|
|
|
|
if (toolbarIndex == ULONG_MAX)
|
|
return;
|
|
|
|
dpiValue = PhGetWindowDpi(ToolBarHandle);
|
|
toolbarButtonSize = (ULONG)SendMessage(ToolBarHandle, TB_GETBUTTONSIZE, 0, 0);
|
|
buttonHeight = ToolbarGetCommandBarButtonHeight();
|
|
commandBarHeight = PhScaleToDisplay(24, dpiValue);
|
|
|
|
// cyChild/cyMinChild describe the toolbar child, not the complete rebar
|
|
// decoration. The rebar adds its own band borders around this height.
|
|
bandChildHeight = __max(commandBarHeight, buttonHeight);
|
|
|
|
SendMessage(ToolBarHandle, TB_SETBUTTONSIZE, 0, MAKELPARAM(0, buttonHeight));
|
|
|
|
if (RebarGetBandIndexChildSize(toolbarIndex, &bandSize))
|
|
{
|
|
bandSize.MinChildWidth = LOWORD(toolbarButtonSize);
|
|
bandSize.InitialChildHeight = bandChildHeight;
|
|
bandSize.MinChildHeight = bandChildHeight;
|
|
// Variable height bands never shrink below their current height unless
|
|
// capped, so pin the maximum to the child height (e.g. 144 -> 96 DPI).
|
|
bandSize.MaximumChildHeight = bandChildHeight;
|
|
RebarSetBandIndexChildSize(toolbarIndex, &bandSize);
|
|
}
|
|
|
|
// The toolbar is CCS_NORESIZE; the rebar sizes the child from the band info
|
|
// above, so don't resize the child here or it can overlap other bands.
|
|
SendMessage(RebarHandle, WM_SIZE, 0, 0);
|
|
}
|
|
|
|
/**
|
|
* Creates the rebar control.
|
|
*/
|
|
VOID RebarCreate(
|
|
VOID
|
|
)
|
|
{
|
|
RebarHandle = RebarCreateWindow(MainWindowHandle);
|
|
}
|
|
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
static VOID MenuBarInitializeLayout(
|
|
VOID
|
|
)
|
|
{
|
|
ULONG menuBarIndex;
|
|
ULONG toolbarIndex;
|
|
ULONG toolbarStyle;
|
|
|
|
if (!MenuBarHandle || !ToolBarHandle)
|
|
return;
|
|
|
|
menuBarIndex = RebarBandToIndex(REBAR_BAND_ID_MENUBAR);
|
|
|
|
if (menuBarIndex != ULONG_MAX && menuBarIndex != 0)
|
|
{
|
|
RebarBandMove(menuBarIndex, 0);
|
|
}
|
|
|
|
toolbarIndex = RebarBandToIndex(REBAR_BAND_ID_TOOLBAR);
|
|
|
|
if (toolbarIndex != ULONG_MAX && toolbarIndex != 1)
|
|
{
|
|
RebarBandMove(toolbarIndex, 1);
|
|
toolbarIndex = RebarBandToIndex(REBAR_BAND_ID_TOOLBAR);
|
|
}
|
|
|
|
if (toolbarIndex != ULONG_MAX && RebarGetBandIndexStyle(toolbarIndex, &toolbarStyle))
|
|
{
|
|
SetFlag(toolbarStyle, RBBS_BREAK);
|
|
RebarSetBandIndexStyle(toolbarIndex, toolbarStyle);
|
|
}
|
|
|
|
if (toolbarIndex != ULONG_MAX)
|
|
{
|
|
ToolbarUpdateBandSize();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Creates the menu bar control.
|
|
*/
|
|
VOID MenuBarCreate(
|
|
VOID
|
|
)
|
|
{
|
|
MenuBarHandle = ToolStatusMenuBarCreateWindow(RebarHandle);
|
|
|
|
if (!MenuBarHandle)
|
|
return;
|
|
|
|
if (ToolbarWindowFont)
|
|
{
|
|
SetWindowFont(MenuBarHandle, ToolbarWindowFont, FALSE);
|
|
}
|
|
|
|
if (ToolbarWindowFont && ToolStatusMenuBarLoadMenu(MenuBarHandle, MainMenu))
|
|
{
|
|
ULONG menuBarButtonSize = (ULONG)SendMessage(MenuBarHandle, TB_GETBUTTONSIZE, 0, 0);
|
|
LONG menuBarButtonHeight = ToolStatusGetWindowFontSize(MenuBarHandle, ToolbarWindowFont);
|
|
|
|
// Apply the final button size before inserting the band so the band height
|
|
// matches the child and the child doesn't overlap the next row.
|
|
if ((LONG)HIWORD(menuBarButtonSize) < menuBarButtonHeight)
|
|
{
|
|
SendMessage(MenuBarHandle, TB_SETBUTTONSIZE, 0, MAKELPARAM(0, menuBarButtonHeight));
|
|
menuBarButtonSize = (ULONG)SendMessage(MenuBarHandle, TB_GETBUTTONSIZE, 0, 0);
|
|
}
|
|
|
|
RebarBandInsert(
|
|
REBAR_BAND_ID_MENUBAR,
|
|
MenuBarHandle,
|
|
LOWORD(menuBarButtonSize),
|
|
__max((LONG)HIWORD(menuBarButtonSize), menuBarButtonHeight)
|
|
);
|
|
}
|
|
else
|
|
{
|
|
DestroyWindow(MenuBarHandle);
|
|
MenuBarHandle = NULL;
|
|
}
|
|
|
|
MenuBarInitializeLayout();
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* Creates the toolbar control.
|
|
*/
|
|
VOID ToolBarCreate(
|
|
VOID
|
|
)
|
|
{
|
|
ToolBarHandle = ToolbarCreateWindow(RebarHandle);
|
|
ToolbarUpdateWindowStyle();
|
|
|
|
if (ToolBarImageList)
|
|
{
|
|
SendMessage(ToolBarHandle, TB_SETIMAGELIST, 0, (LPARAM)ToolBarImageList);
|
|
}
|
|
|
|
if (ToolbarWindowFont)
|
|
{
|
|
SetWindowFont(ToolBarHandle, ToolbarWindowFont, FALSE);
|
|
}
|
|
|
|
ToolbarLoadButtonSettings();
|
|
|
|
//if (EnableThemeSupport)
|
|
//{
|
|
// HWND tooltipWindowHandle;
|
|
|
|
// if (tooltipWindowHandle = (HWND)SendMessage(ToolBarHandle, TB_GETTOOLTIPS, 0, 0))
|
|
// {
|
|
// PhSetControlTheme(tooltipWindowHandle, L"DarkMode_Explorer");
|
|
// }
|
|
//}
|
|
|
|
if (ToolbarWindowFont)
|
|
{
|
|
ULONG toolbarButtonSize = (ULONG)SendMessage(ToolBarHandle, TB_GETBUTTONSIZE, 0, 0);
|
|
LONG toolbarButtonHeight = ToolbarGetCommandBarButtonHeight();
|
|
LONG barwidth = LOWORD(toolbarButtonSize);
|
|
|
|
SendMessage(ToolBarHandle, TB_SETBUTTONSIZE, 0, MAKELPARAM(0, toolbarButtonHeight));
|
|
RebarBandInsert(REBAR_BAND_ID_TOOLBAR, ToolBarHandle, barwidth, toolbarButtonHeight);
|
|
ToolbarUpdateBandSize();
|
|
}
|
|
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
MenuBarInitializeLayout();
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* Creates the search box control.
|
|
*/
|
|
VOID SearchBoxCreate(
|
|
VOID
|
|
)
|
|
{
|
|
SearchboxHandle = PhCreateWindowEx(
|
|
WC_EDIT,
|
|
NULL,
|
|
WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ES_LEFT | ES_AUTOHSCROLL,
|
|
WS_EX_CLIENTEDGE,
|
|
0, 0, 0, 0,
|
|
MainWindowHandle,
|
|
NULL,
|
|
NULL,
|
|
NULL
|
|
);
|
|
|
|
PhCreateSearchControl(
|
|
MainWindowHandle,
|
|
SearchboxHandle,
|
|
L"Search Processes (Ctrl+K)",
|
|
SearchControlCallback,
|
|
NULL
|
|
);
|
|
|
|
if (!SearchboxHandle)
|
|
return;
|
|
|
|
ProcessTreeFilterEntry = PhAddTreeNewFilter(PhGetFilterSupportProcessTreeList(), ProcessTreeFilterCallback, NULL);
|
|
ServiceTreeFilterEntry = PhAddTreeNewFilter(PhGetFilterSupportServiceTreeList(), ServiceTreeFilterCallback, NULL);
|
|
NetworkTreeFilterEntry = PhAddTreeNewFilter(PhGetFilterSupportNetworkTreeList(), NetworkTreeFilterCallback, NULL);
|
|
}
|
|
|
|
/**
|
|
* Updates the search box rebar band.
|
|
*/
|
|
VOID SearchBoxUpdateRebarBand(
|
|
VOID
|
|
)
|
|
{
|
|
ULONG bandIndex;
|
|
LONG dpiValue;
|
|
LONG height;
|
|
LONG width;
|
|
|
|
if (!RebarHandle || !SearchboxHandle)
|
|
return;
|
|
|
|
dpiValue = SystemInformer_GetWindowDpi();
|
|
height = ToolbarGetCommandBarButtonHeight();
|
|
|
|
if (height <= 0)
|
|
{
|
|
height = PhScaleToDisplay(22, dpiValue);
|
|
}
|
|
|
|
width = PhScaleToDisplay(255, dpiValue);
|
|
|
|
if ((bandIndex = RebarBandToIndex(REBAR_BAND_ID_SEARCHBOX)) == ULONG_MAX)
|
|
{
|
|
RebarBandInsert(
|
|
REBAR_BAND_ID_SEARCHBOX,
|
|
SearchboxHandle,
|
|
width,
|
|
height
|
|
);
|
|
}
|
|
else
|
|
{
|
|
BAND_CHILD_SIZE bandSize;
|
|
|
|
if (RebarGetBandIndexChildSize(bandIndex, &bandSize))
|
|
{
|
|
bandSize.InitialChildHeight = height;
|
|
bandSize.MinChildHeight = height;
|
|
bandSize.MaximumChildHeight = height;
|
|
bandSize.MinChildWidth = width;
|
|
RebarSetBandIndexChildSize(bandIndex, &bandSize);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Creates the status bar control.
|
|
*/
|
|
VOID StatusBarCreate(
|
|
VOID
|
|
)
|
|
{
|
|
RECT statusBarRect;
|
|
|
|
ToolStatusGetBarWindowRect(MainWindowHandle, TRUE, &statusBarRect);
|
|
|
|
StatusBarHandle = PhCreateWindow(
|
|
STATUSCLASSNAME,
|
|
NULL,
|
|
WS_CHILD | CCS_BOTTOM | SBARS_SIZEGRIP,
|
|
statusBarRect.left,
|
|
statusBarRect.top,
|
|
statusBarRect.right - statusBarRect.left,
|
|
statusBarRect.bottom - statusBarRect.top,
|
|
MainWindowHandle,
|
|
NULL,
|
|
NULL,
|
|
NULL
|
|
);
|
|
|
|
if (ToolbarWindowFont)
|
|
{
|
|
SetWindowFont(StatusBarHandle, ToolbarWindowFont, FALSE);
|
|
}
|
|
|
|
if (ToolbarWindowFont)
|
|
{
|
|
LONG height = ToolStatusGetWindowFontSize(StatusBarHandle, ToolbarWindowFont);
|
|
RECT statusBarRect;
|
|
|
|
if (PhGetClientRect(StatusBarHandle, &statusBarRect))
|
|
{
|
|
if (statusBarRect.bottom < height)
|
|
{
|
|
SendMessage(StatusBarHandle, SB_SETMINHEIGHT, height, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Destroys the search box control.
|
|
*/
|
|
VOID SearchBoxDestroy(
|
|
VOID
|
|
)
|
|
{
|
|
if (!SearchboxHandle)
|
|
return;
|
|
|
|
if (ProcessTreeFilterEntry)
|
|
{
|
|
PhRemoveTreeNewFilter(PhGetFilterSupportProcessTreeList(), ProcessTreeFilterEntry);
|
|
ProcessTreeFilterEntry = NULL;
|
|
}
|
|
|
|
if (ServiceTreeFilterEntry)
|
|
{
|
|
PhRemoveTreeNewFilter(PhGetFilterSupportServiceTreeList(), ServiceTreeFilterEntry);
|
|
ServiceTreeFilterEntry = NULL;
|
|
}
|
|
|
|
if (NetworkTreeFilterEntry)
|
|
{
|
|
PhRemoveTreeNewFilter(PhGetFilterSupportNetworkTreeList(), NetworkTreeFilterEntry);
|
|
NetworkTreeFilterEntry = NULL;
|
|
}
|
|
|
|
DestroyWindow(SearchboxHandle);
|
|
SearchboxHandle = NULL;
|
|
}
|
|
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
/**
|
|
* Destroys the menu bar control.
|
|
*/
|
|
VOID MenuBarDestroy(
|
|
VOID
|
|
)
|
|
{
|
|
if (!MenuBarHandle)
|
|
return;
|
|
|
|
// Close any open menu and release the menu bar message hook first.
|
|
ToolStatusMenuBarDeactivate(FALSE);
|
|
|
|
DestroyWindow(MenuBarHandle);
|
|
MenuBarHandle = NULL;
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* Destroys the toolbar control.
|
|
*/
|
|
VOID ToolBarDestroy(
|
|
VOID
|
|
)
|
|
{
|
|
if (!ToolBarHandle)
|
|
return;
|
|
|
|
DestroyWindow(ToolBarHandle);
|
|
ToolBarHandle = NULL;
|
|
}
|
|
|
|
/**
|
|
* Destroys the rebar control.
|
|
*/
|
|
VOID RebarDestroy(
|
|
VOID
|
|
)
|
|
{
|
|
if (!RebarHandle)
|
|
return;
|
|
|
|
DestroyWindow(RebarHandle);
|
|
RebarHandle = NULL;
|
|
}
|
|
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
/**
|
|
* Applies settings to the menu bar.
|
|
*/
|
|
VOID MenuBarApplySettings(
|
|
VOID
|
|
)
|
|
{
|
|
ULONG index;
|
|
REBARBANDINFO rebarBandInfo =
|
|
{
|
|
sizeof(REBARBANDINFO),
|
|
RBBIM_IDEALSIZE
|
|
};
|
|
|
|
if (!MenuBarHandle)
|
|
return;
|
|
|
|
if (ToolbarWindowFont)
|
|
SetWindowFont(MenuBarHandle, ToolbarWindowFont, FALSE);
|
|
|
|
// The toolbar only ever grows its button size, so reset it and re-add the
|
|
// buttons; autosize widths (text + padding) are only calculated when the
|
|
// buttons are added, using the current font.
|
|
// The menu bar is text-only; clear the default bitmap size, which the toolbar
|
|
// scales by the DPI at creation and would otherwise keep the minimum button
|
|
// height at the creation DPI (e.g. 144 -> 96 DPI).
|
|
SendMessage(MenuBarHandle, TB_SETBITMAPSIZE, 0, MAKELPARAM(0, 0));
|
|
// Rescale the item padding for the current DPI (no vertical padding; the
|
|
// button height is set from the font height below).
|
|
SendMessage(MenuBarHandle, TB_SETPADDING, 0, MAKELPARAM(PhScaleToDisplay(20, PhGetWindowDpi(MenuBarHandle)), 0));
|
|
SendMessage(MenuBarHandle, TB_SETBUTTONSIZE, 0, MAKELPARAM(0, 0));
|
|
ToolStatusMenuBarLoadMenu(MenuBarHandle, MainMenu);
|
|
|
|
if (ToolbarWindowFont)
|
|
{
|
|
ULONG menuBarButtonSize = (ULONG)SendMessage(MenuBarHandle, TB_GETBUTTONSIZE, 0, 0);
|
|
LONG menuBarButtonHeight = ToolStatusGetWindowFontSize(MenuBarHandle, ToolbarWindowFont);
|
|
|
|
if ((LONG)HIWORD(menuBarButtonSize) < menuBarButtonHeight)
|
|
SendMessage(MenuBarHandle, TB_SETBUTTONSIZE, 0, MAKELPARAM(0, menuBarButtonHeight));
|
|
}
|
|
|
|
SendMessage(MenuBarHandle, TB_AUTOSIZE, 0, 0);
|
|
|
|
if (RebarHandle && (index = RebarBandToIndex(REBAR_BAND_ID_MENUBAR)) != ULONG_MAX)
|
|
{
|
|
BAND_CHILD_SIZE bandSize;
|
|
ULONG menuBarButtonSize = (ULONG)SendMessage(MenuBarHandle, TB_GETBUTTONSIZE, 0, 0);
|
|
|
|
// Update the band height so the row shrinks/grows with the new button size.
|
|
if (RebarGetBandIndexChildSize(index, &bandSize))
|
|
{
|
|
bandSize.MinChildWidth = LOWORD(menuBarButtonSize);
|
|
bandSize.MinChildHeight = HIWORD(menuBarButtonSize);
|
|
bandSize.InitialChildHeight = HIWORD(menuBarButtonSize);
|
|
// Variable height bands never shrink below their current height unless
|
|
// capped, so pin the maximum to the child height (e.g. 144 -> 96 DPI).
|
|
bandSize.MaximumChildHeight = HIWORD(menuBarButtonSize);
|
|
RebarSetBandIndexChildSize(index, &bandSize);
|
|
}
|
|
|
|
if (SendMessage(RebarHandle, RB_GETBANDINFO, index, (LPARAM)&rebarBandInfo))
|
|
{
|
|
SIZE idealWidth = { 0, 0 };
|
|
|
|
if (SendMessage(MenuBarHandle, TB_GETIDEALSIZE, FALSE, (LPARAM)&idealWidth))
|
|
{
|
|
rebarBandInfo.cxIdeal = (ULONG)idealWidth.cx;
|
|
SendMessage(RebarHandle, RB_SETBANDINFO, index, (LPARAM)&rebarBandInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* Applies settings to the toolbar.
|
|
*
|
|
* \param DpiChanged Whether the DPI has changed.
|
|
*/
|
|
VOID ToolBarApplySettings(
|
|
_In_ BOOLEAN DpiChanged
|
|
)
|
|
{
|
|
LONG index;
|
|
LONG buttonCount;
|
|
ULONG bandIndex;
|
|
REBARBANDINFO rebarBandInfo =
|
|
{
|
|
sizeof(REBARBANDINFO),
|
|
RBBIM_IDEALSIZE
|
|
};
|
|
|
|
if (!ToolBarHandle)
|
|
return;
|
|
|
|
if (DpiChanged)
|
|
{
|
|
// Reset the image list so the toolbar picks up the new icon size
|
|
// (setting the same handle again doesn't update the cached bitmap size).
|
|
SendMessage(ToolBarHandle, TB_SETIMAGELIST, 0, 0);
|
|
|
|
if (ToolBarImageList)
|
|
{
|
|
SendMessage(ToolBarHandle, TB_SETIMAGELIST, 0, (LPARAM)ToolBarImageList);
|
|
}
|
|
|
|
// The toolbar only ever grows its button size, so reset it before re-adding
|
|
// the buttons; autosize widths are calculated from the current font when added.
|
|
ToolbarRemoveButtons();
|
|
SendMessage(ToolBarHandle, TB_SETBUTTONSIZE, 0, MAKELPARAM(0, 0));
|
|
ToolbarLoadButtonSettings();
|
|
}
|
|
|
|
buttonCount = (LONG)SendMessage(ToolBarHandle, TB_BUTTONCOUNT, 0, 0);
|
|
|
|
for (index = 0; index < buttonCount; index++)
|
|
{
|
|
TBBUTTONINFO buttonInfo =
|
|
{
|
|
sizeof(TBBUTTONINFO),
|
|
TBIF_BYINDEX | TBIF_STYLE | TBIF_COMMAND | TBIF_STATE
|
|
};
|
|
|
|
if (SendMessage(ToolBarHandle, TB_GETBUTTONINFO, index, (LPARAM)&buttonInfo) == INT_ERROR)
|
|
break;
|
|
|
|
if (buttonInfo.fsStyle == BTNS_SEP)
|
|
continue;
|
|
|
|
buttonInfo.dwMask |= TBIF_TEXT;
|
|
buttonInfo.pszText = (PWSTR)ToolbarGetText(buttonInfo.idCommand);
|
|
|
|
switch (DisplayStyle)
|
|
{
|
|
case TOOLBAR_DISPLAY_STYLE_IMAGEONLY:
|
|
buttonInfo.fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
|
|
break;
|
|
case TOOLBAR_DISPLAY_STYLE_SELECTIVETEXT:
|
|
{
|
|
switch (buttonInfo.idCommand)
|
|
{
|
|
case PHAPP_ID_VIEW_REFRESH:
|
|
case PHAPP_ID_HACKER_OPTIONS:
|
|
case PHAPP_ID_HACKER_FINDHANDLESORDLLS:
|
|
case PHAPP_ID_VIEW_SYSTEMINFORMATION:
|
|
buttonInfo.fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT;
|
|
break;
|
|
default:
|
|
buttonInfo.fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case TOOLBAR_DISPLAY_STYLE_ALLTEXT:
|
|
buttonInfo.fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT;
|
|
break;
|
|
}
|
|
|
|
switch (buttonInfo.idCommand)
|
|
{
|
|
case PHAPP_ID_HACKER_SHOWDETAILSFORALLPROCESSES:
|
|
{
|
|
if (PhGetOwnTokenAttributes().Elevated)
|
|
{
|
|
ClearFlag(buttonInfo.fsState, TBSTATE_ENABLED);
|
|
}
|
|
}
|
|
break;
|
|
case PHAPP_ID_VIEW_ALWAYSONTOP:
|
|
{
|
|
if (PhGetIntegerSetting(SETTING_MAIN_WINDOW_ALWAYS_ON_TOP))
|
|
{
|
|
SetFlag(buttonInfo.fsState, TBSTATE_PRESSED);
|
|
}
|
|
}
|
|
break;
|
|
case TIDC_POWERMENUDROPDOWN:
|
|
{
|
|
SetFlag(buttonInfo.fsStyle, BTNS_WHOLEDROPDOWN);
|
|
}
|
|
break;
|
|
}
|
|
|
|
SendMessage(ToolBarHandle, TB_SETBUTTONINFO, index, (LPARAM)&buttonInfo);
|
|
}
|
|
|
|
SendMessage(RebarHandle, WM_SETREDRAW, FALSE, 0);
|
|
|
|
SendMessage(ToolBarHandle, TB_AUTOSIZE, 0, 0);
|
|
|
|
if (RebarHandle && (bandIndex = RebarBandToIndex(REBAR_BAND_ID_TOOLBAR)) != ULONG_MAX)
|
|
{
|
|
if (SendMessage(RebarHandle, RB_GETBANDINFO, bandIndex, (LPARAM)&rebarBandInfo))
|
|
{
|
|
SIZE idealWidth = { 0, 0 };
|
|
|
|
if (SendMessage(ToolBarHandle, TB_GETIDEALSIZE, FALSE, (LPARAM)&idealWidth))
|
|
{
|
|
rebarBandInfo.cxIdeal = (ULONG)idealWidth.cx;
|
|
SendMessage(RebarHandle, RB_SETBANDINFO, bandIndex, (LPARAM)&rebarBandInfo);
|
|
}
|
|
}
|
|
}
|
|
|
|
SendMessage(RebarHandle, WM_SETREDRAW, TRUE, 0);
|
|
//InvalidateRect(RebarHandle, NULL, TRUE);
|
|
}
|
|
|
|
/**
|
|
* Applies settings to the search box.
|
|
*/
|
|
VOID SearchBoxApplySettings(
|
|
VOID
|
|
)
|
|
{
|
|
if (ToolStatusConfig.SearchBoxEnabled && RebarHandle && SearchboxHandle)
|
|
{
|
|
ShowWindow(SearchboxHandle, SW_SHOW);
|
|
|
|
if (SearchBoxDisplayMode == SEARCHBOX_DISPLAY_MODE_HIDEINACTIVE)
|
|
{
|
|
RebarBandRemove(REBAR_BAND_ID_SEARCHBOX);
|
|
}
|
|
else
|
|
{
|
|
SearchBoxUpdateRebarBand();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
RebarBandRemove(REBAR_BAND_ID_SEARCHBOX);
|
|
|
|
if (SearchboxHandle)
|
|
{
|
|
PhSearchControlClear(SearchboxHandle);
|
|
ShowWindow(SearchboxHandle, SW_HIDE);
|
|
|
|
if (!ToolStatusConfig.SearchBoxEnabled || !RebarHandle)
|
|
{
|
|
SearchBoxDestroy();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Applies settings to the status bar.
|
|
*/
|
|
VOID StatusBarApplySettings(
|
|
VOID
|
|
)
|
|
{
|
|
if (ToolStatusConfig.StatusBarEnabled)
|
|
{
|
|
if (StatusBarHandle && !IsWindowVisible(StatusBarHandle))
|
|
{
|
|
ShowWindow(StatusBarHandle, SW_SHOW);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (StatusBarHandle && IsWindowVisible(StatusBarHandle))
|
|
{
|
|
ShowWindow(StatusBarHandle, SW_HIDE);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Loads toolbar settings.
|
|
*
|
|
* \param DpiChanged Whether the DPI has changed.
|
|
*/
|
|
VOID ToolbarLoadSettings(
|
|
_In_ BOOLEAN DpiChanged
|
|
)
|
|
{
|
|
ToolbarUpdateFont();
|
|
|
|
if (ToolStatusConfig.ToolBarEnabled)
|
|
{
|
|
ToolbarUpdateImageList(DpiChanged);
|
|
|
|
if (!RebarHandle)
|
|
{
|
|
RebarCreate();
|
|
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
if (ToolStatusConfig.EnableMenuBar && MainMenu && !MenuBarHandle)
|
|
MenuBarCreate();
|
|
#endif
|
|
|
|
if (!ToolBarHandle)
|
|
ToolBarCreate();
|
|
}
|
|
|
|
if (ToolStatusConfig.SearchBoxEnabled && !SearchboxHandle)
|
|
{
|
|
SearchBoxCreate();
|
|
}
|
|
|
|
if (ToolStatusConfig.StatusBarEnabled && !StatusBarHandle)
|
|
{
|
|
StatusBarCreate();
|
|
}
|
|
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
MenuBarApplySettings();
|
|
#endif
|
|
ToolBarApplySettings(DpiChanged);
|
|
ToolbarUpdateBandSize();
|
|
|
|
if (RebarHandle && !IsWindowVisible(RebarHandle))
|
|
ShowWindow(RebarHandle, SW_SHOW);
|
|
}
|
|
else
|
|
{
|
|
if (RebarHandle)
|
|
{
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
MenuBarDestroy();
|
|
#endif
|
|
ToolBarDestroy();
|
|
RebarDestroy();
|
|
}
|
|
|
|
if (ToolBarImageList)
|
|
{
|
|
PhImageListDestroy(ToolBarImageList);
|
|
ToolBarImageList = NULL;
|
|
}
|
|
}
|
|
|
|
SearchBoxApplySettings();
|
|
StatusBarApplySettings();
|
|
|
|
ToolbarInitialized = TRUE;
|
|
|
|
// Invoke the LayoutPaddingCallback.
|
|
InvalidateMainWindowLayout();
|
|
}
|
|
|
|
/**
|
|
* Removes all buttons from the toolbar.
|
|
*/
|
|
VOID ToolbarRemoveButtons(
|
|
VOID
|
|
)
|
|
{
|
|
LONG buttonCount = (LONG)SendMessage(ToolBarHandle, TB_BUTTONCOUNT, 0, 0);
|
|
|
|
while (buttonCount--)
|
|
SendMessage(ToolBarHandle, TB_DELETEBUTTON, (WPARAM)buttonCount, 0);
|
|
}
|
|
|
|
/**
|
|
* Creates the toolbar controls.
|
|
*/
|
|
VOID ToolbarCreateControls(
|
|
VOID
|
|
)
|
|
{
|
|
ToolbarLoadSettings(FALSE);
|
|
ToolbarCreateGraphs();
|
|
ReBarLoadLayoutSettings();
|
|
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
MenuBarApplySettings();
|
|
#endif
|
|
|
|
ToolStatusApplyMainMenuVisibility(MainWindowHandle);
|
|
|
|
if (ToolStatusConfig.SearchBoxEnabled && ToolStatusConfig.SearchAutoFocus && SearchboxHandle)
|
|
{
|
|
SetFocus(SearchboxHandle);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Destroys the toolbar controls.
|
|
*/
|
|
VOID ToolbarDestroyControls(
|
|
VOID
|
|
)
|
|
{
|
|
ToolbarDestroyGraphs();
|
|
SearchBoxDestroy();
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
MenuBarDestroy();
|
|
#endif
|
|
ToolBarDestroy();
|
|
RebarDestroy();
|
|
}
|
|
|
|
/**
|
|
* Resets the toolbar settings to the default values.
|
|
*/
|
|
VOID ToolbarResetSettings(
|
|
VOID
|
|
)
|
|
{
|
|
// Remove all buttons.
|
|
ToolbarRemoveButtons();
|
|
|
|
// Add the default buttons.
|
|
ToolbarLoadDefaultButtonSettings();
|
|
}
|
|
|
|
/**
|
|
* Maps a persisted (stable) toolbar id to the current live PHAPP_ID_* command id when loading
|
|
* settings.
|
|
*
|
|
* \param CommandID The stable command identifier.
|
|
* \return The corresponding live command identifier.
|
|
* \remarks The stable namespace is owned by this plugin and never changes, so the layout
|
|
* survives shifts in the main application's auto-generated resource ids. Legacy on-disk values
|
|
* (original historical ids, and raw PHAPP_ID_* from older builds) are migrated here too; the next
|
|
* save rewrites everything in the stable namespace. TIDC_* and separators (0) pass through.
|
|
*/
|
|
static ULONG ToolbarMapStableToCommandId(
|
|
_In_ ULONG CommandID
|
|
)
|
|
{
|
|
switch (CommandID)
|
|
{
|
|
// Current stable namespace (what new saves write)
|
|
case TOOLBAR_SAVE_ID_REFRESH:
|
|
return PHAPP_ID_VIEW_REFRESH;
|
|
case TOOLBAR_SAVE_ID_OPTIONS:
|
|
return PHAPP_ID_HACKER_OPTIONS;
|
|
case TOOLBAR_SAVE_ID_FINDHANDLESORDLLS:
|
|
return PHAPP_ID_HACKER_FINDHANDLESORDLLS;
|
|
case TOOLBAR_SAVE_ID_SYSTEMINFORMATION:
|
|
return PHAPP_ID_VIEW_SYSTEMINFORMATION;
|
|
case TOOLBAR_SAVE_ID_SHOWDETAILSFORALLPROCESSES:
|
|
return PHAPP_ID_HACKER_SHOWDETAILSFORALLPROCESSES;
|
|
case TOOLBAR_SAVE_ID_ALWAYSONTOP:
|
|
return PHAPP_ID_VIEW_ALWAYSONTOP;
|
|
case TOOLBAR_SAVE_ID_RUNASADMINISTRATOR:
|
|
return PHAPP_ID_HACKER_RUNASADMINISTRATOR;
|
|
|
|
// Migration only: original historical ids from older configs
|
|
case 40079:
|
|
return PHAPP_ID_HACKER_SHOWDETAILSFORALLPROCESSES;
|
|
case 40082:
|
|
return PHAPP_ID_HACKER_FINDHANDLESORDLLS;
|
|
case 40083:
|
|
return PHAPP_ID_HACKER_OPTIONS;
|
|
case 40091:
|
|
return PHAPP_ID_VIEW_SYSTEMINFORMATION;
|
|
case 40098:
|
|
return PHAPP_ID_VIEW_REFRESH;
|
|
case 40153:
|
|
return PHAPP_ID_VIEW_ALWAYSONTOP;
|
|
case 40077:
|
|
return PHAPP_ID_HACKER_RUNASADMINISTRATOR;
|
|
}
|
|
|
|
// TIDC_*, separators (0), and raw PHAPP_ID_* (already-live) configs fall through unchanged.
|
|
return CommandID;
|
|
}
|
|
|
|
/**
|
|
* Maps a live PHAPP_ID_* command id to the stable id used for persistence when saving settings.
|
|
*
|
|
* \param CommandID The live command identifier.
|
|
* \return The corresponding stable command identifier.
|
|
* \remarks TIDC_* and separators (0) pass through.
|
|
*/
|
|
static ULONG ToolbarMapCommandIdToStable(
|
|
_In_ ULONG CommandID
|
|
)
|
|
{
|
|
switch (CommandID)
|
|
{
|
|
case PHAPP_ID_VIEW_REFRESH:
|
|
return TOOLBAR_SAVE_ID_REFRESH;
|
|
case PHAPP_ID_HACKER_OPTIONS:
|
|
return TOOLBAR_SAVE_ID_OPTIONS;
|
|
case PHAPP_ID_HACKER_FINDHANDLESORDLLS:
|
|
return TOOLBAR_SAVE_ID_FINDHANDLESORDLLS;
|
|
case PHAPP_ID_VIEW_SYSTEMINFORMATION:
|
|
return TOOLBAR_SAVE_ID_SYSTEMINFORMATION;
|
|
case PHAPP_ID_HACKER_SHOWDETAILSFORALLPROCESSES:
|
|
return TOOLBAR_SAVE_ID_SHOWDETAILSFORALLPROCESSES;
|
|
case PHAPP_ID_VIEW_ALWAYSONTOP:
|
|
return TOOLBAR_SAVE_ID_ALWAYSONTOP;
|
|
case PHAPP_ID_HACKER_RUNASADMINISTRATOR:
|
|
return TOOLBAR_SAVE_ID_RUNASADMINISTRATOR;
|
|
}
|
|
|
|
return CommandID;
|
|
}
|
|
|
|
/**
|
|
* Gets the text associated with a toolbar command.
|
|
*
|
|
* \param CommandID The command identifier.
|
|
* \return A pointer to the text string.
|
|
*/
|
|
PCWSTR ToolbarGetText(
|
|
_In_ ULONG CommandID
|
|
)
|
|
{
|
|
switch (CommandID)
|
|
{
|
|
case PHAPP_ID_VIEW_REFRESH:
|
|
return L"Refresh";
|
|
case PHAPP_ID_HACKER_OPTIONS:
|
|
return L"Options";
|
|
case PHAPP_ID_HACKER_FINDHANDLESORDLLS:
|
|
return L"Find handles or DLLs";
|
|
case PHAPP_ID_VIEW_SYSTEMINFORMATION:
|
|
return L"System information";
|
|
case TIDC_FINDWINDOW:
|
|
return L"Find window";
|
|
case TIDC_FINDWINDOWTHREAD:
|
|
return L"Find window and thread";
|
|
case TIDC_FINDWINDOWKILL:
|
|
return L"Find window and kill";
|
|
case PHAPP_ID_VIEW_ALWAYSONTOP:
|
|
return L"Always on top";
|
|
case TIDC_POWERMENUDROPDOWN:
|
|
return L"Computer";
|
|
case PHAPP_ID_HACKER_SHOWDETAILSFORALLPROCESSES:
|
|
return L"Show details for all processes";
|
|
case TIDC_FINDDIALOG:
|
|
return L"Find";
|
|
}
|
|
|
|
return L"ERROR";
|
|
}
|
|
|
|
/**
|
|
* Loads a bitmap from an icon resource.
|
|
*
|
|
* \param Width The width of the image.
|
|
* \param Height The height of the image.
|
|
* \param Name The name or resource identifier of the icon.
|
|
* \param DpiValue The DPI value for scaling.
|
|
* \return A handle to the created bitmap.
|
|
*/
|
|
HBITMAP ToolbarLoadImageFromIcon(
|
|
_In_ LONG Width,
|
|
_In_ LONG Height,
|
|
_In_ PWSTR Name,
|
|
_In_ LONG DpiValue
|
|
)
|
|
{
|
|
HICON icon = PhLoadIcon(PluginInstance->DllBase, Name, 0, Width, Height, DpiValue);
|
|
HBITMAP bitmap = PhIconToBitmap(icon, Width, Height);
|
|
DestroyIcon(icon);
|
|
return bitmap;
|
|
}
|
|
|
|
/**
|
|
* Gets the image associated with a toolbar command.
|
|
*
|
|
* \param CommandID The command identifier.
|
|
* \param DpiValue The DPI value for scaling.
|
|
* \return A handle to the bitmap image.
|
|
*/
|
|
HBITMAP ToolbarGetImage(
|
|
_In_ ULONG CommandID,
|
|
_In_ LONG DpiValue
|
|
)
|
|
{
|
|
ULONG id = ULONG_MAX;
|
|
|
|
switch (CommandID)
|
|
{
|
|
case PHAPP_ID_VIEW_REFRESH:
|
|
{
|
|
if (ToolStatusConfig.ModernIcons)
|
|
{
|
|
if (EnableThemeSupport)
|
|
id = IDB_ARROW_REFRESH_MODERN_LIGHT;
|
|
else
|
|
id = IDB_ARROW_REFRESH_MODERN_DARK;
|
|
}
|
|
else
|
|
{
|
|
id = IDI_ARROW_REFRESH;
|
|
}
|
|
}
|
|
break;
|
|
case PHAPP_ID_HACKER_OPTIONS:
|
|
{
|
|
if (ToolStatusConfig.ModernIcons)
|
|
{
|
|
if (EnableThemeSupport)
|
|
id = IDB_COG_EDIT_MODERN_LIGHT;
|
|
else
|
|
id = IDB_COG_EDIT_MODERN_DARK;
|
|
}
|
|
else
|
|
{
|
|
id = IDI_COG_EDIT;
|
|
}
|
|
}
|
|
break;
|
|
case PHAPP_ID_HACKER_FINDHANDLESORDLLS:
|
|
case TIDC_FINDDIALOG:
|
|
{
|
|
if (ToolStatusConfig.ModernIcons)
|
|
{
|
|
if (EnableThemeSupport)
|
|
id = IDB_FIND_MODERN_LIGHT;
|
|
else
|
|
id = IDB_FIND_MODERN_DARK;
|
|
}
|
|
else
|
|
{
|
|
id = IDI_FIND;
|
|
}
|
|
}
|
|
break;
|
|
case PHAPP_ID_VIEW_SYSTEMINFORMATION:
|
|
{
|
|
if (ToolStatusConfig.ModernIcons)
|
|
{
|
|
if (EnableThemeSupport)
|
|
id = IDB_CHART_LINE_MODERN_LIGHT;
|
|
else
|
|
id = IDB_CHART_LINE_MODERN_DARK;
|
|
}
|
|
else
|
|
{
|
|
id = IDI_CHART_LINE;
|
|
}
|
|
}
|
|
break;
|
|
case TIDC_FINDWINDOW:
|
|
{
|
|
if (ToolStatusConfig.ModernIcons)
|
|
{
|
|
if (EnableThemeSupport)
|
|
id = IDB_TBAPPLICATION_MODERN_LIGHT;
|
|
else
|
|
id = IDB_TBAPPLICATION_MODERN_DARK;
|
|
}
|
|
else
|
|
{
|
|
id = IDI_TBAPPLICATION;
|
|
}
|
|
}
|
|
break;
|
|
case TIDC_FINDWINDOWTHREAD:
|
|
{
|
|
if (ToolStatusConfig.ModernIcons)
|
|
{
|
|
if (EnableThemeSupport)
|
|
id = IDB_APPLICATION_GO_MODERN_LIGHT;
|
|
else
|
|
id = IDB_APPLICATION_GO_MODERN_DARK;
|
|
}
|
|
else
|
|
{
|
|
id = IDI_APPLICATION_GO;
|
|
}
|
|
}
|
|
break;
|
|
case TIDC_FINDWINDOWKILL:
|
|
{
|
|
if (ToolStatusConfig.ModernIcons)
|
|
{
|
|
if (EnableThemeSupport)
|
|
id = IDB_CROSS_MODERN_LIGHT;
|
|
else
|
|
id = IDB_CROSS_MODERN_DARK;
|
|
}
|
|
else
|
|
{
|
|
id = IDI_CROSS;
|
|
}
|
|
}
|
|
break;
|
|
case PHAPP_ID_VIEW_ALWAYSONTOP:
|
|
{
|
|
if (ToolStatusConfig.ModernIcons)
|
|
{
|
|
if (EnableThemeSupport)
|
|
id = IDB_APPLICATION_GET_MODERN_LIGHT;
|
|
else
|
|
id = IDB_APPLICATION_GET_MODERN_DARK;
|
|
}
|
|
else
|
|
{
|
|
id = IDI_APPLICATION_GET;
|
|
}
|
|
}
|
|
break;
|
|
case TIDC_POWERMENUDROPDOWN:
|
|
{
|
|
if (ToolStatusConfig.ModernIcons)
|
|
{
|
|
if (EnableThemeSupport)
|
|
id = IDB_LIGHTBULB_OFF_MODERN_LIGHT;
|
|
else
|
|
id = IDB_LIGHTBULB_OFF_MODERN_DARK;
|
|
}
|
|
else
|
|
{
|
|
id = IDI_LIGHTBULB_OFF;
|
|
}
|
|
}
|
|
break;
|
|
case PHAPP_ID_HACKER_SHOWDETAILSFORALLPROCESSES:
|
|
{
|
|
return PhGetShieldBitmap(DpiValue, ToolBarImageSize.cx, ToolBarImageSize.cy);
|
|
}
|
|
break;
|
|
}
|
|
|
|
if (id != ULONG_MAX)
|
|
{
|
|
if (ToolStatusConfig.ModernIcons)
|
|
{
|
|
return PhLoadImageFormatFromResource(PluginInstance->DllBase, MAKEINTRESOURCE(id), L"PNG", PH_IMAGE_FORMAT_TYPE_PNG, ToolBarImageSize.cx, ToolBarImageSize.cy);
|
|
}
|
|
|
|
return ToolbarLoadImageFromIcon(ToolBarImageSize.cx, ToolBarImageSize.cy, MAKEINTRESOURCE(id), DpiValue);
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
/**
|
|
* Loads the default toolbar button settings.
|
|
*/
|
|
VOID ToolbarLoadDefaultButtonSettings(
|
|
VOID
|
|
)
|
|
{
|
|
LONG dpiValue = SystemInformer_GetWindowDpi();
|
|
|
|
// Pre-cache the images in the Toolbar array.
|
|
|
|
for (ULONG i = 0; i < ARRAYSIZE(ToolbarButtons); i++)
|
|
{
|
|
PTBBUTTON toolbarButton = &ToolbarButtons[i];
|
|
HBITMAP bitmap;
|
|
|
|
if (FlagOn(toolbarButton->fsStyle, BTNS_SEP))
|
|
continue;
|
|
|
|
if (bitmap = ToolbarGetImage(toolbarButton->idCommand, dpiValue))
|
|
{
|
|
// Add the image, cache the value in the ToolbarButtons array, set the bitmap index.
|
|
toolbarButton->iBitmap = PhImageListAddBitmap(
|
|
ToolBarImageList,
|
|
bitmap,
|
|
NULL
|
|
);
|
|
|
|
DeleteBitmap(bitmap);
|
|
}
|
|
|
|
// Note: We have to set the string here because TBIF_TEXT doesn't update
|
|
// the button text length when the button is disabled. (dmex)
|
|
toolbarButton->iString = (INT_PTR)(PVOID)ToolbarGetText(toolbarButton->idCommand);
|
|
}
|
|
|
|
// Load default settings
|
|
SendMessage(ToolBarHandle, TB_ADDBUTTONS, MAX_DEFAULT_TOOLBAR_ITEMS, (LPARAM)ToolbarButtons);
|
|
}
|
|
|
|
/**
|
|
* Loads the toolbar button settings from the configuration.
|
|
*/
|
|
VOID ToolbarLoadButtonSettings(
|
|
VOID
|
|
)
|
|
{
|
|
ULONG count;
|
|
ULONG64 countInteger;
|
|
ULONG insertedCount = 0;
|
|
PPH_STRING settingsString;
|
|
PTBBUTTON buttonArray;
|
|
PH_STRINGREF remaining;
|
|
PH_STRINGREF part;
|
|
LONG dpiValue;
|
|
|
|
settingsString = PhGetStringSetting(SETTING_NAME_TOOLBAR_CONFIG);
|
|
|
|
if (PhIsNullOrEmptyString(settingsString))
|
|
{
|
|
ToolbarLoadDefaultButtonSettings();
|
|
goto CleanupExit;
|
|
}
|
|
|
|
remaining = PhGetStringRef(settingsString);
|
|
|
|
// Query the number of buttons to insert
|
|
if (!PhSplitStringRefAtChar(&remaining, L'|', &part, &remaining))
|
|
{
|
|
ToolbarLoadDefaultButtonSettings();
|
|
goto CleanupExit;
|
|
}
|
|
|
|
if (!PhStringToUInt64(&part, 10, &countInteger))
|
|
{
|
|
ToolbarLoadDefaultButtonSettings();
|
|
goto CleanupExit;
|
|
}
|
|
|
|
// The count comes from settings and drives a stack allocation, so reject a
|
|
// value that cannot describe a real toolbar layout. Separators mean the saved
|
|
// layout can be longer than the button table, so allow a small multiple of it
|
|
// rather than an exact match. (dmex)
|
|
if (countInteger > (ULONG64)RTL_NUMBER_OF(ToolbarButtons) * 4)
|
|
{
|
|
ToolbarLoadDefaultButtonSettings();
|
|
goto CleanupExit;
|
|
}
|
|
|
|
count = (ULONG)countInteger;
|
|
dpiValue = SystemInformer_GetWindowDpi();
|
|
|
|
// Preserve the previous behaviour for an explicitly empty layout without
|
|
// performing a zero-sized stack allocation. (dmex)
|
|
if (count == 0)
|
|
{
|
|
ToolbarRemoveButtons();
|
|
goto CleanupExit;
|
|
}
|
|
|
|
// Allocate the button array
|
|
buttonArray = PhAllocateStack(count * sizeof(TBBUTTON));
|
|
if (!buttonArray) goto CleanupExit;
|
|
memset(buttonArray, 0, count * sizeof(TBBUTTON));
|
|
|
|
for (ULONG index = 0; index < count; index++)
|
|
{
|
|
PTBBUTTON button = &buttonArray[index];
|
|
ULONG64 commandInteger;
|
|
PH_STRINGREF commandIdPart;
|
|
|
|
if (remaining.Length == 0)
|
|
break;
|
|
|
|
PhSplitStringRefAtChar(&remaining, L'|', &commandIdPart, &remaining);
|
|
|
|
if (!PhStringToUInt64(&commandIdPart, 10, &commandInteger))
|
|
continue;
|
|
|
|
button->idCommand = (LONG)ToolbarMapStableToCommandId((ULONG)commandInteger);
|
|
button->iBitmap = I_IMAGECALLBACK;
|
|
button->fsState = TBSTATE_ENABLED;
|
|
|
|
if (commandInteger)
|
|
{
|
|
button->fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
|
|
// Note: We have to set the string here because TBIF_TEXT doesn't update
|
|
// the button text length when the button is disabled. (dmex)
|
|
button->iString = (INT_PTR)(PVOID)ToolbarGetText((ULONG)button->idCommand);
|
|
}
|
|
else
|
|
{
|
|
button->fsStyle = BTNS_SEP;
|
|
}
|
|
|
|
// Pre-cache the image in the Toolbar array on startup.
|
|
for (ULONG i = 0; i < ARRAYSIZE(ToolbarButtons); i++)
|
|
{
|
|
PTBBUTTON toolbarButton = &ToolbarButtons[i];
|
|
|
|
if (toolbarButton->idCommand == button->idCommand)
|
|
{
|
|
HBITMAP bitmap;
|
|
|
|
if (FlagOn(button->fsStyle, BTNS_SEP))
|
|
continue;
|
|
|
|
if (bitmap = ToolbarGetImage(toolbarButton->idCommand, dpiValue))
|
|
{
|
|
// Add the image, cache the value in the ToolbarButtons array, set the bitmap index.
|
|
button->iBitmap = toolbarButton->iBitmap = PhImageListAddBitmap(
|
|
ToolBarImageList,
|
|
bitmap,
|
|
NULL
|
|
);
|
|
|
|
DeleteBitmap(bitmap);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
insertedCount++;
|
|
}
|
|
|
|
ToolbarRemoveButtons();
|
|
|
|
SendMessage(ToolBarHandle, TB_ADDBUTTONS, insertedCount, (LPARAM)buttonArray);
|
|
|
|
PhFreeStack(buttonArray);
|
|
|
|
CleanupExit:
|
|
PhClearReference(&settingsString);
|
|
}
|
|
|
|
/**
|
|
* Saves the toolbar button settings to the configuration.
|
|
*/
|
|
VOID ToolbarSaveButtonSettings(
|
|
VOID
|
|
)
|
|
{
|
|
LONG index;
|
|
LONG count;
|
|
PPH_STRING settingsString;
|
|
PH_STRING_BUILDER stringBuilder;
|
|
|
|
PhInitializeStringBuilder(&stringBuilder, 100);
|
|
|
|
count = (LONG)SendMessage(ToolBarHandle, TB_BUTTONCOUNT, 0, 0);
|
|
|
|
PhAppendFormatStringBuilder(
|
|
&stringBuilder,
|
|
L"%d|",
|
|
count
|
|
);
|
|
|
|
for (index = 0; index < count; index++)
|
|
{
|
|
TBBUTTONINFO buttonInfo =
|
|
{
|
|
sizeof(TBBUTTONINFO),
|
|
TBIF_BYINDEX | TBIF_IMAGE | TBIF_STYLE | TBIF_COMMAND
|
|
};
|
|
|
|
if (SendMessage(ToolBarHandle, TB_GETBUTTONINFO, index, (LPARAM)&buttonInfo) == INT_ERROR)
|
|
break;
|
|
|
|
PhAppendFormatStringBuilder(
|
|
&stringBuilder,
|
|
L"%d|",
|
|
ToolbarMapCommandIdToStable(buttonInfo.idCommand)
|
|
);
|
|
}
|
|
|
|
if (stringBuilder.String->Length != 0)
|
|
PhRemoveEndStringBuilder(&stringBuilder, 1);
|
|
|
|
settingsString = PhFinalStringBuilderString(&stringBuilder);
|
|
PhSetStringSetting2(SETTING_NAME_TOOLBAR_CONFIG, &settingsString->sr);
|
|
PhDereferenceObject(settingsString);
|
|
}
|
|
|
|
/**
|
|
* Loads the rebar layout settings from the configuration.
|
|
*/
|
|
VOID ReBarLoadLayoutSettings(
|
|
VOID
|
|
)
|
|
{
|
|
ULONG index;
|
|
ULONG count;
|
|
PPH_STRING settingsString;
|
|
PH_STRINGREF remaining;
|
|
|
|
settingsString = PhGetStringSetting(
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
ToolStatusConfig.EnableMenuBar ? SETTING_NAME_REBAR_MENUBAR_CONFIG :
|
|
#endif
|
|
SETTING_NAME_REBAR_CONFIG
|
|
);
|
|
remaining = settingsString->sr;
|
|
|
|
if (remaining.Length == 0)
|
|
return;
|
|
|
|
if (!RebarGetBandCount(&count))
|
|
return;
|
|
|
|
SendMessage(RebarHandle, WM_SETREDRAW, FALSE, 0);
|
|
|
|
for (index = 0; index < count; index++)
|
|
{
|
|
PH_STRINGREF idPart;
|
|
PH_STRINGREF cxPart;
|
|
PH_STRINGREF stylePart;
|
|
ULONG64 idInteger;
|
|
ULONG64 cxInteger;
|
|
ULONG64 styleInteger;
|
|
ULONG oldBandIndex;
|
|
ULONG bandid;
|
|
ULONG bandstyle;
|
|
ULONG bandwidth;
|
|
BAND_STYLE_SIZE rebarBandInfo;
|
|
|
|
if (remaining.Length == 0)
|
|
break;
|
|
|
|
PhSplitStringRefAtChar(&remaining, L'|', &idPart, &remaining);
|
|
PhSplitStringRefAtChar(&remaining, L'|', &cxPart, &remaining);
|
|
PhSplitStringRefAtChar(&remaining, L'|', &stylePart, &remaining);
|
|
|
|
if (!PhStringToUInt64(&idPart, 10, &idInteger))
|
|
continue;
|
|
if (!PhStringToUInt64(&cxPart, 10, &cxInteger))
|
|
continue;
|
|
if (!PhStringToUInt64(&stylePart, 10, &styleInteger))
|
|
continue;
|
|
if (!NT_SUCCESS(RtlULong64ToULong(idInteger, &bandid)))
|
|
continue;
|
|
if (!NT_SUCCESS(RtlULong64ToULong(cxInteger, &bandwidth)))
|
|
continue;
|
|
if (!NT_SUCCESS(RtlULong64ToULong(styleInteger, &bandstyle)))
|
|
continue;
|
|
|
|
if ((oldBandIndex = RebarBandToIndex(bandid)) != ULONG_MAX && oldBandIndex != index)
|
|
{
|
|
RebarBandMove(oldBandIndex, index);
|
|
}
|
|
|
|
if (RebarGetBandIndexStyleSize(index, &rebarBandInfo))
|
|
{
|
|
SetFlag(rebarBandInfo.BandStyle, bandstyle);
|
|
rebarBandInfo.BandWidth = bandwidth;
|
|
RebarSetBandIndexStyleSize(index, &rebarBandInfo);
|
|
}
|
|
}
|
|
|
|
SendMessage(RebarHandle, WM_SETREDRAW, TRUE, 0);
|
|
//InvalidateRect(RebarHandle, NULL, TRUE);
|
|
}
|
|
|
|
/**
|
|
* Saves the rebar layout settings to the configuration.
|
|
*/
|
|
VOID ReBarSaveLayoutSettings(
|
|
VOID
|
|
)
|
|
{
|
|
ULONG index;
|
|
ULONG count;
|
|
PPH_STRING settingsString;
|
|
PH_STRING_BUILDER stringBuilder;
|
|
|
|
PhInitializeStringBuilder(&stringBuilder, 100);
|
|
|
|
if (RebarGetBandCount(&count))
|
|
{
|
|
SendMessage(RebarHandle, WM_SETREDRAW, FALSE, 0);
|
|
|
|
for (index = 0; index < count; index++)
|
|
{
|
|
REBARBANDINFO rebarBandInfo =
|
|
{
|
|
sizeof(REBARBANDINFO),
|
|
RBBIM_STYLE | RBBIM_SIZE | RBBIM_ID
|
|
};
|
|
|
|
SendMessage(RebarHandle, RB_GETBANDINFO, index, (LPARAM)&rebarBandInfo);
|
|
|
|
if (FlagOn(rebarBandInfo.fStyle, RBBS_GRIPPERALWAYS))
|
|
{
|
|
ClearFlag(rebarBandInfo.fStyle, RBBS_GRIPPERALWAYS);
|
|
}
|
|
|
|
if (FlagOn(rebarBandInfo.fStyle, RBBS_NOGRIPPER))
|
|
{
|
|
ClearFlag(rebarBandInfo.fStyle, RBBS_NOGRIPPER);
|
|
}
|
|
|
|
if (FlagOn(rebarBandInfo.fStyle, RBBS_FIXEDSIZE))
|
|
{
|
|
ClearFlag(rebarBandInfo.fStyle, RBBS_FIXEDSIZE);
|
|
}
|
|
|
|
PhAppendFormatStringBuilder(
|
|
&stringBuilder,
|
|
L"%u|%u|%u|",
|
|
rebarBandInfo.wID,
|
|
rebarBandInfo.cx,
|
|
rebarBandInfo.fStyle
|
|
);
|
|
}
|
|
|
|
SendMessage(RebarHandle, WM_SETREDRAW, TRUE, 0);
|
|
//InvalidateRect(RebarHandle, NULL, TRUE);
|
|
|
|
if (stringBuilder.String->Length != 0)
|
|
PhRemoveEndStringBuilder(&stringBuilder, 1);
|
|
}
|
|
|
|
settingsString = PhFinalStringBuilderString(&stringBuilder);
|
|
PhSetStringSetting2(
|
|
#if TOOLSTATUS_ENABLE_MENUBAR
|
|
ToolStatusConfig.EnableMenuBar ? SETTING_NAME_REBAR_MENUBAR_CONFIG :
|
|
#endif
|
|
SETTING_NAME_REBAR_CONFIG,
|
|
&settingsString->sr
|
|
);
|
|
PhDereferenceObject(settingsString);
|
|
}
|
|
|
|
/**
|
|
* Adjusts the height of all bands in the rebar control.
|
|
*
|
|
* \param Height The new height for the bands.
|
|
*/
|
|
VOID RebarAdjustBandHeightLayout(
|
|
_In_ LONG Height
|
|
)
|
|
{
|
|
ULONG index;
|
|
ULONG count;
|
|
|
|
if (!RebarGetBandCount(&count))
|
|
return;
|
|
|
|
for (index = 0; index < count; index++)
|
|
{
|
|
BAND_CHILD_SIZE rebarBandInfo;
|
|
|
|
if (RebarGetBandIndexChildSize(index, &rebarBandInfo))
|
|
{
|
|
rebarBandInfo.InitialChildHeight = Height;
|
|
rebarBandInfo.MinChildHeight = Height;
|
|
RebarSetBandIndexChildSize(index, &rebarBandInfo);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Calculates the font size for a window.
|
|
*
|
|
* \param WindowHandle A handle to the window.
|
|
* \param WindowFont A handle to the font.
|
|
* \return The calculated height of the font, including padding.
|
|
*/
|
|
LONG ToolStatusGetWindowFontSize(
|
|
_In_ HWND WindowHandle,
|
|
_In_ HFONT WindowFont
|
|
)
|
|
{
|
|
LONG height = 0;
|
|
TEXTMETRIC textMetrics;
|
|
HDC hdc;
|
|
|
|
if (hdc = GetDC(WindowHandle))
|
|
{
|
|
SelectFont(hdc, WindowFont);
|
|
GetTextMetrics(hdc, &textMetrics);
|
|
|
|
// Below we try to match the height as calculated by the toolbar, even if it
|
|
// involves magic numbers. On Vista and above there seems to be extra padding.
|
|
|
|
height = textMetrics.tmHeight;
|
|
ReleaseDC(WindowHandle, hdc);
|
|
}
|
|
|
|
height += 5; // Add magic padding
|
|
|
|
return height;
|
|
}
|
|
|
|
/**
|
|
* Calculates the initial rectangle of a bar docked to the parent client area.
|
|
*
|
|
* \param ParentWindowHandle A handle to the parent window.
|
|
* \param Bottom TRUE to dock the bar to the bottom of the parent, FALSE for the top.
|
|
* \param BarRect The bar rectangle, in parent client coordinates.
|
|
*/
|
|
VOID ToolStatusGetBarWindowRect(
|
|
_In_ HWND ParentWindowHandle,
|
|
_In_ BOOLEAN Bottom,
|
|
_Out_ PRECT BarRect
|
|
)
|
|
{
|
|
RECT clientRect;
|
|
LONG height;
|
|
|
|
if (!PhGetClientRect(ParentWindowHandle, &clientRect))
|
|
SetRectEmpty(&clientRect);
|
|
|
|
if (ToolbarWindowFont)
|
|
height = ToolStatusGetWindowFontSize(ParentWindowHandle, ToolbarWindowFont);
|
|
else
|
|
height = PhScaleToDisplay(24, PhGetWindowDpi(ParentWindowHandle));
|
|
|
|
BarRect->left = clientRect.left;
|
|
BarRect->right = clientRect.right;
|
|
|
|
if (Bottom)
|
|
{
|
|
BarRect->top = clientRect.bottom - height;
|
|
BarRect->bottom = clientRect.bottom;
|
|
}
|
|
else
|
|
{
|
|
BarRect->top = clientRect.top;
|
|
BarRect->bottom = clientRect.top + height;
|
|
}
|
|
}
|