ToolStatus: Fixed non-client handling; Fixed searchbox font issues; Removed uxtheme drawing;

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5660 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
dmex
2015-02-02 12:50:31 +00:00
parent 1ed6ef5e01
commit 613d2e4e55
4 changed files with 105 additions and 336 deletions
+42 -34
View File
@@ -27,12 +27,11 @@ BOOLEAN EnableToolBar = FALSE;
BOOLEAN EnableSearchBox = FALSE;
BOOLEAN EnableStatusBar = FALSE;
TOOLBAR_DISPLAY_STYLE DisplayStyle = ToolbarDisplaySelectiveText;
HWND ReBarHandle = NULL;
HWND RebarHandle = NULL;
HWND ToolBarHandle = NULL;
HWND TextboxHandle = NULL;
HWND SearchboxHandle = NULL;
HACCEL AcceleratorTable = NULL;
PPH_STRING SearchboxText = NULL;
HFONT SearchboxFontHandle = NULL;
PPH_TN_FILTER_ENTRY ProcessTreeFilterEntry = NULL;
PPH_TN_FILTER_ENTRY ServiceTreeFilterEntry = NULL;
PPH_TN_FILTER_ENTRY NetworkTreeFilterEntry = NULL;
@@ -68,24 +67,24 @@ static VOID NTAPI TabPageUpdatedCallback(
{
INT tabIndex = (INT)Parameter;
if (TextboxHandle)
if (!SearchboxHandle)
return;
switch (tabIndex)
{
switch (tabIndex)
{
case 0:
Edit_SetCueBannerText(TextboxHandle, L"Search Processes (Ctrl+K)");
break;
case 1:
Edit_SetCueBannerText(TextboxHandle, L"Search Services (Ctrl+K)");
break;
case 2:
Edit_SetCueBannerText(TextboxHandle, L"Search Network (Ctrl+K)");
break;
default:
// Disable the textbox if we're on an unsupported tab.
Edit_SetCueBannerText(TextboxHandle, L"Search Disabled");
break;
}
case 0:
Edit_SetCueBannerText(SearchboxHandle, L"Search Processes (Ctrl+K)");
break;
case 1:
Edit_SetCueBannerText(SearchboxHandle, L"Search Services (Ctrl+K)");
break;
case 2:
Edit_SetCueBannerText(SearchboxHandle, L"Search Network (Ctrl+K)");
break;
default:
// Disable the textbox if we're on an unsupported tab.
Edit_SetCueBannerText(SearchboxHandle, L"Search Disabled");
break;
}
}
@@ -96,13 +95,13 @@ static VOID NTAPI LayoutPaddingCallback(
{
PPH_LAYOUT_PADDING_DATA data = (PPH_LAYOUT_PADDING_DATA)Parameter;
if (ReBarHandle)
if (RebarHandle)
{
RECT rebarRect = { 0 };
SendMessage(ReBarHandle, WM_SIZE, 0, 0);
SendMessage(RebarHandle, WM_SIZE, 0, 0);
GetClientRect(ReBarHandle, &rebarRect);
GetClientRect(RebarHandle, &rebarRect);
// Adjust the PH client area and exclude the rebar width.
data->Padding.top += rebarRect.bottom;
@@ -195,7 +194,7 @@ static LRESULT CALLBACK MainWndSubclassProc(
case EN_CHANGE:
{
// Cache the current search text for our callback.
PhSwapReference2(&SearchboxText, PhGetWindowText(TextboxHandle));
PhSwapReference2(&SearchboxText, PhGetWindowText(SearchboxHandle));
// Expand the nodes so we can search them
PhExpandAllProcessNodes(TRUE);
@@ -230,8 +229,8 @@ static LRESULT CALLBACK MainWndSubclassProc(
// handle keybind Ctrl + K
if (EnableToolBar && EnableSearchBox)
{
SetFocus(TextboxHandle);
Edit_SetSel(TextboxHandle, 0, -1);
SetFocus(SearchboxHandle);
Edit_SetSel(SearchboxHandle, 0, -1);
}
goto DefaultWndProc;
@@ -241,8 +240,8 @@ static LRESULT CALLBACK MainWndSubclassProc(
{
if (EnableToolBar && EnableSearchBox)
{
SetFocus(TextboxHandle);
Static_SetText(TextboxHandle, L"");
SetFocus(SearchboxHandle);
Static_SetText(SearchboxHandle, L"");
}
goto DefaultWndProc;
@@ -255,7 +254,7 @@ static LRESULT CALLBACK MainWndSubclassProc(
{
LPNMHDR hdr = (LPNMHDR)lParam;
if (hdr->hwndFrom == ReBarHandle)
if (hdr->hwndFrom == RebarHandle)
{
if (hdr->code == RBN_HEIGHTCHANGE)
{
@@ -295,6 +294,13 @@ static LRESULT CALLBACK MainWndSubclassProc(
}
break;
case TBN_INITCUSTOMIZE:
{
struct
{
NMHDR hdr;
HWND hDlg; // handle of the customization dialog.
} *initcustomize = (PVOID)lParam;
}
return TBNRF_HIDEHELP;
case TBN_QUERYINSERT:
case TBN_QUERYDELETE:
@@ -535,11 +541,13 @@ static LRESULT CALLBACK MainWndSubclassProc(
}
}
break;
case WM_SIZE:
{
// Resize PH main window client-area.
ProcessHacker_InvalidateLayoutPadding(hWnd);
}
case WM_SIZE:
// Resize PH main window client-area.
ProcessHacker_InvalidateLayoutPadding(hWnd);
break;
case WM_SETTINGCHANGE:
// Reinitilize the fonts.
SendMessage(SearchboxHandle, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
break;
}
+26 -256
View File
@@ -23,156 +23,6 @@
#include "toolstatus.h"
//NONCLIENTMETRICS metrics = { sizeof(NONCLIENTMETRICS) };
//metrics.lfMenuFont.lfHeight = 14;
//metrics.lfMenuFont.lfWeight = FW_NORMAL;
//metrics.lfMenuFont.lfQuality = CLEARTYPE_QUALITY | ANTIALIASED_QUALITY;
#ifdef _UXTHEME_ENABLED_
#include <uxtheme.h>
#include <vsstyle.h>
#include <vssym32.h>
typedef HRESULT (WINAPI *_GetThemeColor)(
_In_ HTHEME hTheme,
_In_ INT iPartId,
_In_ INT iStateId,
_In_ INT iPropId,
_Out_ COLORREF *pColor
);
typedef HRESULT (WINAPI *_SetWindowTheme)(
_In_ HWND hwnd,
_In_ LPCWSTR pszSubAppName,
_In_ LPCWSTR pszSubIdList
);
typedef HRESULT (WINAPI *_GetThemeFont)(
_In_ HTHEME hTheme,
_In_ HDC hdc,
_In_ INT iPartId,
_In_ INT iStateId,
_In_ INT iPropId,
_Out_ LOGFONTW *pFont
);
typedef HRESULT (WINAPI *_GetThemeSysFont)(
_In_ HTHEME hTheme,
_In_ INT iFontId,
_Out_ LOGFONTW *plf
);
typedef BOOL (WINAPI *_IsThemeBackgroundPartiallyTransparent)(
_In_ HTHEME hTheme,
_In_ INT iPartId,
_In_ INT iStateId
);
typedef HRESULT (WINAPI *_DrawThemeParentBackground)(
_In_ HWND hwnd,
_In_ HDC hdc,
_In_opt_ const RECT* prc
);
typedef HRESULT (WINAPI *_GetThemeBackgroundContentRect)(
_In_ HTHEME hTheme,
_In_ HDC hdc,
_In_ INT iPartId,
_In_ INT iStateId,
_Inout_ LPCRECT pBoundingRect,
_Out_ LPRECT pContentRect
);
static _IsThemeActive IsThemeActive_I;
static _OpenThemeData OpenThemeData_I;
static _SetWindowTheme SetWindowTheme_I;
static _CloseThemeData CloseThemeData_I;
static _IsThemePartDefined IsThemePartDefined_I;
static _DrawThemeBackground DrawThemeBackground_I;
static _DrawThemeParentBackground DrawThemeParentBackground_I;
static _IsThemeBackgroundPartiallyTransparent IsThemeBackgroundPartiallyTransparent_I;
static _GetThemeColor GetThemeColor_I;
static _GetThemeInt GetThemeInt_I;
static VOID NcAreaInitializeUxTheme(
_Inout_ PEDIT_CONTEXT Context
)
{
if (!Context->UxThemeModule)
Context->UxThemeModule = LoadLibrary(L"uxtheme.dll");
if (Context->UxThemeModule)
{
IsThemeActive_I = (_IsThemeActive)GetProcAddress(Context->UxThemeModule, "IsThemeActive");
OpenThemeData_I = (_OpenThemeData)GetProcAddress(Context->UxThemeModule, "OpenThemeData");
SetWindowTheme_I = (_SetWindowTheme)GetProcAddress(Context->UxThemeModule, "SetWindowTheme");
CloseThemeData_I = (_CloseThemeData)GetProcAddress(Context->UxThemeModule, "CloseThemeData");
GetThemeColor_I = (_GetThemeColor)GetProcAddress(Context->UxThemeModule, "GetThemeColor");
GetThemeInt_I = (_GetThemeInt)GetProcAddress(Context->UxThemeModule, "GetThemeInt");
IsThemePartDefined_I = (_IsThemePartDefined)GetProcAddress(Context->UxThemeModule, "IsThemePartDefined");
DrawThemeBackground_I = (_DrawThemeBackground)GetProcAddress(Context->UxThemeModule, "DrawThemeBackground");
DrawThemeParentBackground_I = (_DrawThemeParentBackground)GetProcAddress(Context->UxThemeModule, "DrawThemeParentBackground");
IsThemeBackgroundPartiallyTransparent_I = (_IsThemeBackgroundPartiallyTransparent)GetProcAddress(Context->UxThemeModule, "IsThemeBackgroundPartiallyTransparent");
}
if (IsThemeActive_I && OpenThemeData_I && CloseThemeData_I && IsThemePartDefined_I && DrawThemeBackground_I)
{
INT borderSize = 0;
if (Context->UxThemeHandle)
CloseThemeData_I(Context->UxThemeHandle);
Context->IsThemeActive = IsThemeActive_I();
Context->UxThemeHandle = OpenThemeData_I(Context->WindowHandle, VSCLASS_EDIT);
if (Context->UxThemeHandle)
{
Context->IsThemeBackgroundActive = IsThemePartDefined_I(
Context->UxThemeHandle,
EP_EDITBORDER_NOSCROLL,
0
);
// Get the border size from the theme
GetThemeInt_I(
Context->UxThemeHandle,
EP_EDITBORDER_NOSCROLL,
EPSN_NORMAL,
TMT_BORDERSIZE,
&borderSize
);
//GetThemeColor_I(
// Context->UxThemeHandle,
// EP_EDITBORDER_NOSCROLL,
// EPSN_NORMAL,
// TMT_FILLCOLOR,
// &Context->BackgroundColorRef
// );
//GetThemeColor_I(
// Context->UxThemeHandle,
// EP_EDITBORDER_NOSCROLL,
// EPSN_NORMAL,
// TMT_BORDERCOLOR,
// &Context->clrUxThemeBackgroundRef
// );
Context->CXBorder = borderSize * 2;
Context->CYBorder = borderSize * 2;
}
else
{
Context->IsThemeBackgroundActive = FALSE;
}
}
else
{
Context->UxThemeHandle = NULL;
Context->IsThemeActive = FALSE;
Context->IsThemeBackgroundActive = FALSE;
}
}
#endif _UXTHEME_ENABLED_
static VOID NcAreaFreeGdiTheme(
_Inout_ PEDIT_CONTEXT Context
)
@@ -257,7 +107,7 @@ static LRESULT CALLBACK NcAreaWndSubclassProc(
_In_ WPARAM wParam,
_In_ LPARAM lParam,
_In_ UINT_PTR uIdSubclass,
_In_ DWORD_PTR dwRefData
_In_ ULONG_PTR dwRefData
)
{
PEDIT_CONTEXT context = (PEDIT_CONTEXT)GetProp(hwndDlg, L"EditSubclassContext");
@@ -272,14 +122,6 @@ static LRESULT CALLBACK NcAreaWndSubclassProc(
if (context->ImageList)
ImageList_Destroy(context->ImageList);
#ifdef _UXTHEME_ENABLED_
if (CloseThemeData_I && context->UxThemeHandle)
CloseThemeData_I(context->UxThemeHandle);
if (context->UxThemeModule)
FreeLibrary(context->UxThemeModule);
#endif
RemoveWindowSubclass(hwndDlg, NcAreaWndSubclassProc, 0);
RemoveProp(hwndDlg, L"EditSubclassContext");
PhFree(context);
@@ -291,32 +133,28 @@ static LRESULT CALLBACK NcAreaWndSubclassProc(
case WM_ERASEBKGND:
return TRUE;
case WM_SYSCOLORCHANGE:
case WM_STYLECHANGED:
case WM_THEMECHANGED:
{
NcAreaFreeGdiTheme(context);
NcAreaInitializeGdiTheme(context);
#ifdef _UXTHEME_ENABLED_
NcAreaInitializeUxTheme(context);
#endif _UXTHEME_ENABLED_
{
NcAreaFreeGdiTheme(context);
NcAreaInitializeGdiTheme(context);
}
break;
case WM_NCCALCSIZE:
{
if (wParam)
{
LPNCCALCSIZE_PARAMS ncCalcSize = (NCCALCSIZE_PARAMS*)lParam;
LPNCCALCSIZE_PARAMS ncCalcSize = (NCCALCSIZE_PARAMS*)lParam;
ncCalcSize->rgrc[0].right -= context->cxImgSize;
}
DefSubclassProc(hwndDlg, uMsg, wParam, lParam);
ncCalcSize->rgrc[0].right -= context->cxImgSize;
}
break;
return 0;
case WM_NCPAINT:
{
HDC hdc = NULL;
RECT clientRect = { 0 };
DefSubclassProc(hwndDlg, uMsg, wParam, lParam);
// Get the screen coordinates of the client window.
GetClientRect(hwndDlg, &clientRect);
// Adjust the coordinates (start from border edge).
@@ -336,79 +174,6 @@ static LRESULT CALLBACK NcAreaWndSubclassProc(
SetBkMode(hdc, TRANSPARENT);
// Draw the themed background.
#ifdef _UXTHEME_ENABLED_
if (context->IsThemeActive)
{
if (isFocused)
{
if (IsThemeBackgroundPartiallyTransparent_I(
context->UxThemeHandle,
EP_EDITBORDER_NOSCROLL,
EPSN_FOCUSED
))
{
DrawThemeParentBackground_I(hwndDlg, hdc, NULL);
}
DrawThemeBackground_I(
context->UxThemeHandle,
hdc,
EP_EDITBORDER_NOSCROLL,
EPSN_FOCUSED,
&windowRect,
NULL
);
}
#ifdef _HOTTRACK_ENABLED_
else if (context->MouseInClient)
{
if (IsThemeBackgroundPartiallyTransparent_I(
context->UxThemeHandle,
EP_EDITBORDER_NOSCROLL,
EPSN_HOT
))
{
DrawThemeParentBackground_I(hwndDlg, hdc, NULL);
}
DrawThemeBackground_I(
context->UxThemeHandle,
hdc,
EP_EDITBORDER_NOSCROLL,
EPSN_HOT,
&windowRect,
NULL
);
}
#endif _HOTTRACK_ENABLED_
else
{
if (IsThemeBackgroundPartiallyTransparent_I(
context->UxThemeHandle,
EP_EDITBORDER_NOSCROLL,
EPSN_NORMAL
))
{
DrawThemeParentBackground_I(hwndDlg, hdc, NULL);
}
DrawThemeBackground_I(
context->UxThemeHandle,
hdc,
EP_EDITBORDER_NOSCROLL,
EPSN_NORMAL,
&windowRect,
NULL
);
}
}
else
#endif _UXTHEME_ENABLED_
{
}
FillRect(hdc, &context->SearchButtonRect, context->BrushFill);
//if (isFocused)
@@ -458,7 +223,7 @@ static LRESULT CALLBACK NcAreaWndSubclassProc(
ReleaseDC(hwndDlg, hdc);
}
break;
return 0;
case WM_NCHITTEST:
{
POINT windowPoint = { 0 };
@@ -725,14 +490,14 @@ HWND CreateSearchControl(
_In_ UINT CommandID
)
{
PEDIT_CONTEXT context = (PEDIT_CONTEXT)PhAllocate(sizeof(EDIT_CONTEXT));
PEDIT_CONTEXT context;
context = (PEDIT_CONTEXT)PhAllocate(sizeof(EDIT_CONTEXT));
memset(context, 0, sizeof(EDIT_CONTEXT));
context->cxImgSize = 22;
context->CommandID = CommandID;
SearchboxText = PhReferenceEmptyString();
NcAreaInitializeGdiTheme(context);
NcAreaInitializeImageList(context);
@@ -743,24 +508,29 @@ HWND CreateSearchControl(
NULL,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ES_LEFT,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
ReBarHandle,
RebarHandle,
NULL,
(HINSTANCE)PluginInstance->DllBase,
NULL
);
// Set Searchbox font.
SendMessage(context->WindowHandle, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), FALSE);
// Reset the client area margins.
SendMessage(context->WindowHandle, EM_SETMARGINS, EC_LEFTMARGIN, MAKELPARAM(0, 0));
// Set initial text
Edit_SetCueBannerText(context->WindowHandle, L"Search Processes (Ctrl+K)");
// Set our window context data.
SetProp(context->WindowHandle, L"EditSubclassContext", (HANDLE)context);
// Subclass the Edit control window procedure.
SetWindowSubclass(context->WindowHandle, NcAreaWndSubclassProc, 0, (ULONG_PTR)context);
#ifdef _UXTHEME_ENABLED_
SendMessage(context->WindowHandle, WM_THEMECHANGED, 0, 0);
#endif _UXTHEME_ENABLED_
// Force the edit control to update its non-client area.
RedrawWindow(context->WindowHandle, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
SetWindowPos(context->WindowHandle, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
return context->WindowHandle;
}
+33 -32
View File
@@ -80,6 +80,7 @@ static VOID RebarLoadSettings(
VOID
)
{
// Initialize the Toolbar Imagelist.
if (!ToolBarImageList)
{
HBITMAP arrowIconBitmap = NULL;
@@ -168,12 +169,12 @@ static VOID RebarLoadSettings(
}
// Load the Rebar, Toolbar and Searchbox controls.
if (EnableToolBar && !ReBarHandle)
if (EnableToolBar && !RebarHandle)
{
REBARINFO rebarInfo = { sizeof(REBARINFO) };
// Create the ReBar window.
ReBarHandle = CreateWindowEx(
RebarHandle = CreateWindowEx(
WS_EX_TOOLWINDOW,
REBARCLASSNAME,
NULL,
@@ -185,6 +186,9 @@ static VOID RebarLoadSettings(
NULL
);
// Set the toolbar info with no imagelist.
SendMessage(RebarHandle, RB_SETBARINFO, 0, (LPARAM)&rebarInfo);
// Create the ToolBar window.
ToolBarHandle = CreateWindowEx(
0,
@@ -192,13 +196,16 @@ static VOID RebarLoadSettings(
NULL,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NORESIZE | CCS_NODIVIDER | CCS_ADJUSTABLE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
ReBarHandle,
RebarHandle,
NULL,
(HINSTANCE)PluginInstance->DllBase,
NULL
);
// Manually add button strings (Fixes some exceptions under x64 Windows)
// Manually add button strings via TB_ADDSTRING.
// NOTE: The Toolbar will sometimes decide to free strings hard-coded via (INT_PTR)L"String"
// in the ToolbarButtons array causing random crashes unless we manually add the strings
// into the Toolbar string pool (this bug only affects 64bit Windows)... WTF???
ToolbarButtons[0].iString = SendMessage(ToolBarHandle, TB_ADDSTRING, 0, (LPARAM)L"Refresh");
ToolbarButtons[1].iString = SendMessage(ToolBarHandle, TB_ADDSTRING, 0, (LPARAM)L"Options");
ToolbarButtons[3].iString = SendMessage(ToolBarHandle, TB_ADDSTRING, 0, (LPARAM)L"Find Handles or DLLs");
@@ -207,8 +214,6 @@ static VOID RebarLoadSettings(
ToolbarButtons[7].iString = SendMessage(ToolBarHandle, TB_ADDSTRING, 0, (LPARAM)L"Find Window and Thread");
ToolbarButtons[8].iString = SendMessage(ToolBarHandle, TB_ADDSTRING, 0, (LPARAM)L"Find Window and Kill");
// Set the toolbar info with no imagelist.
SendMessage(ReBarHandle, RB_SETBARINFO, 0, (LPARAM)&rebarInfo);
// Set the toolbar struct size.
SendMessage(ToolBarHandle, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
// Set the toolbar extended toolbar styles.
@@ -225,29 +230,24 @@ static VOID RebarLoadSettings(
//SendMessage(ToolBarHandle, TB_SETWINDOWTHEME, 0, (LPARAM)L"Communications"); //Media/Communications/BrowserTabBar/Help
// HACK: Query the toolbar width/height.
ULONG toolbarButtonSize = (ULONG)SendMessage(ToolBarHandle, TB_GETBUTTONSIZE, 0, 0);
// Inset the toolbar into the rebar control.
RebarAddMenuItem(ReBarHandle, ToolBarHandle, HIWORD(toolbarButtonSize), LOWORD(toolbarButtonSize));
ULONG_PTR toolbarButtonSize = (ULONG_PTR)SendMessage(ToolBarHandle, TB_GETBUTTONSIZE, 0, 0);
// Inset the toolbar into the rebar control.
RebarAddMenuItem(RebarHandle, ToolBarHandle, HIWORD(toolbarButtonSize), LOWORD(toolbarButtonSize));
if (EnableSearchBox && !SearchboxHandle)
{
SearchboxText = PhReferenceEmptyString();
if (EnableSearchBox && !TextboxHandle)
{
ProcessTreeFilterEntry = PhAddTreeNewFilter(PhGetFilterSupportProcessTreeList(), (PPH_TN_FILTER_FUNCTION)ProcessTreeFilterCallback, NULL);
ServiceTreeFilterEntry = PhAddTreeNewFilter(PhGetFilterSupportServiceTreeList(), (PPH_TN_FILTER_FUNCTION)ServiceTreeFilterCallback, NULL);
NetworkTreeFilterEntry = PhAddTreeNewFilter(PhGetFilterSupportNetworkTreeList(), (PPH_TN_FILTER_FUNCTION)NetworkTreeFilterCallback, NULL);
// Insert a paint region into the edit control NC window area
TextboxHandle = CreateSearchControl(ID_SEARCH_CLEAR);
// Set font
SendMessage(TextboxHandle, WM_SETFONT, (WPARAM)PhApplicationFont, FALSE);
// Reset the client area margins.
SendMessage(TextboxHandle, EM_SETMARGINS, EC_LEFTMARGIN, MAKELPARAM(0, 0));
// Set initial text
Edit_SetCueBannerText(TextboxHandle, L"Search Processes (Ctrl+K)");
SearchboxHandle = CreateSearchControl(ID_SEARCH_CLEAR);
// Insert the edit control into the rebar control
RebarAddMenuItem(ReBarHandle, TextboxHandle, 20, 180);
RebarAddMenuItem(RebarHandle, SearchboxHandle, 20, 180);
}
}
@@ -271,30 +271,30 @@ static VOID RebarLoadSettings(
// Hide or show controls (Note: don't unload or remove at runtime).
if (EnableToolBar)
{
if (ReBarHandle && !IsWindowVisible(ReBarHandle))
ShowWindow(ReBarHandle, SW_SHOW);
if (RebarHandle && !IsWindowVisible(RebarHandle))
ShowWindow(RebarHandle, SW_SHOW);
}
else
{
if (ReBarHandle && IsWindowVisible(ReBarHandle))
ShowWindow(ReBarHandle, SW_HIDE);
if (RebarHandle && IsWindowVisible(RebarHandle))
ShowWindow(RebarHandle, SW_HIDE);
}
if (EnableSearchBox)
{
if (TextboxHandle && !IsWindowVisible(TextboxHandle))
ShowWindow(TextboxHandle, SW_SHOW);
if (SearchboxHandle && !IsWindowVisible(SearchboxHandle))
ShowWindow(SearchboxHandle, SW_SHOW);
}
else
{
if (TextboxHandle)
if (SearchboxHandle)
{
// Clear search text and reset search filters.
SetFocus(TextboxHandle);
Static_SetText(TextboxHandle, L"");
SetFocus(SearchboxHandle);
Static_SetText(SearchboxHandle, L"");
if (IsWindowVisible(TextboxHandle))
ShowWindow(TextboxHandle, SW_HIDE);
if (IsWindowVisible(SearchboxHandle))
ShowWindow(SearchboxHandle, SW_HIDE);
}
}
@@ -310,6 +310,7 @@ static VOID RebarLoadSettings(
}
}
VOID LoadToolbarSettings(
VOID
)
+4 -14
View File
@@ -38,11 +38,6 @@
#include "resource.h"
// Enable Searchbox HotTracking
//#define _HOTTRACK_ENABLED_
// Enable Searchbox UxTheme drawing
//#define _UXTHEME_ENABLED_
#define SETTING_PREFIX L"ProcessHacker.ToolStatus"
#define SETTING_NAME_ENABLE_TOOLBAR (SETTING_PREFIX L".EnableToolBar")
#define SETTING_NAME_ENABLE_SEARCHBOX (SETTING_PREFIX L".EnableSearchBox")
@@ -84,9 +79,9 @@ extern TOOLBAR_DISPLAY_STYLE DisplayStyle;
extern ULONG StatusMask;
extern ULONG ProcessesUpdatedCount;
extern HWND ReBarHandle;
extern HWND RebarHandle;
extern HWND ToolBarHandle;
extern HWND TextboxHandle;
extern HWND SearchboxHandle;
extern HWND StatusBarHandle;
extern HACCEL AcceleratorTable;
extern PPH_STRING SearchboxText;
@@ -102,9 +97,11 @@ extern PPH_TN_FILTER_ENTRY NetworkTreeFilterEntry;
VOID UpdateStatusBar(
VOID
);
VOID ShowStatusMenu(
_In_ PPOINT Point
);
VOID LoadToolbarSettings(
VOID
);
@@ -153,13 +150,6 @@ typedef struct _EDIT_CONTEXT
COLORREF BackgroundColorRef;
BOOLEAN MouseInClient;
#ifdef _UXTHEME_ENABLED_
BOOLEAN IsThemeActive;
BOOL IsThemeBackgroundActive;
HTHEME UxThemeHandle;
HMODULE UxThemeModule;
#endif
} EDIT_CONTEXT, *PEDIT_CONTEXT;
HBITMAP LoadImageFromResources(