Update window procedure callbacks
This commit is contained in:
@@ -217,7 +217,9 @@ LRESULT CALLBACK PhMipSectionControlHookWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
);
|
||||
|
||||
// List-based section
|
||||
|
||||
@@ -128,8 +128,6 @@ typedef struct _PH_SYSINFO_SECTION
|
||||
HWND DialogHandle;
|
||||
HWND PanelHandle;
|
||||
ULONG PanelId;
|
||||
WNDPROC GraphOldWndProc;
|
||||
WNDPROC PanelOldWndProc;
|
||||
// begin_phapppub
|
||||
} PH_SYSINFO_SECTION, *PPH_SYSINFO_SECTION;
|
||||
// end_phapppub
|
||||
|
||||
@@ -193,14 +193,18 @@ LRESULT CALLBACK PhSipGraphHookWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
);
|
||||
|
||||
LRESULT CALLBACK PhSipPanelHookWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
);
|
||||
|
||||
// Misc.
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* mini information window
|
||||
*
|
||||
* Copyright (C) 2015-2016 wj32
|
||||
* Copyright (C) 2017 dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
@@ -60,7 +61,6 @@ static PH_LAYOUT_MANAGER PhMipLayoutManager;
|
||||
static RECT MinimumSize;
|
||||
static PH_CALLBACK_REGISTRATION ProcessesUpdatedRegistration;
|
||||
static PH_STRINGREF DownArrowPrefix = PH_STRINGREF_INIT(L"\u25be ");
|
||||
static WNDPROC SectionControlOldWndProc;
|
||||
|
||||
static PPH_LIST SectionList;
|
||||
static PH_MINIINFO_PARAMETERS CurrentParameters;
|
||||
@@ -464,8 +464,7 @@ VOID PhMipOnInitDialog(
|
||||
PhAddLayoutItem(&PhMipLayoutManager, GetDlgItem(PhMipWindow, IDC_PIN), NULL,
|
||||
PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);
|
||||
|
||||
SectionControlOldWndProc = (WNDPROC)GetWindowLongPtr(GetDlgItem(PhMipWindow, IDC_SECTION), GWLP_WNDPROC);
|
||||
SetWindowLongPtr(GetDlgItem(PhMipWindow, IDC_SECTION), GWLP_WNDPROC, (LONG_PTR)PhMipSectionControlHookWndProc);
|
||||
SetWindowSubclass(GetDlgItem(PhMipWindow, IDC_SECTION), PhMipSectionControlHookWndProc, 0, 0);
|
||||
|
||||
Button_SetCheck(GetDlgItem(PhMipWindow, IDC_PIN), !!PhGetIntegerSetting(L"MiniInfoWindowPinned"));
|
||||
}
|
||||
@@ -1145,11 +1144,16 @@ LRESULT CALLBACK PhMipSectionControlHookWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
RemoveWindowSubclass(hwnd, PhMipSectionControlHookWndProc, uIdSubclass);
|
||||
break;
|
||||
case WM_SETCURSOR:
|
||||
{
|
||||
SetCursor(LoadCursor(NULL, IDC_HAND));
|
||||
@@ -1157,7 +1161,7 @@ LRESULT CALLBACK PhMipSectionControlHookWndProc(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return CallWindowProc(SectionControlOldWndProc, hwnd, uMsg, wParam, lParam);
|
||||
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
PPH_MINIINFO_LIST_SECTION PhMipCreateListSection(
|
||||
|
||||
+12
-6
@@ -3,6 +3,7 @@
|
||||
* options window
|
||||
*
|
||||
* Copyright (C) 2010-2016 wj32
|
||||
* Copyright (C) 2017 dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
@@ -44,7 +45,9 @@ LRESULT CALLBACK PhpOptionsWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
);
|
||||
|
||||
INT_PTR CALLBACK PhpOptionsGeneralDlgProc(
|
||||
@@ -87,7 +90,6 @@ static BOOLEAN PageInit;
|
||||
static BOOLEAN PressedOk;
|
||||
static BOOLEAN RestartRequired;
|
||||
static POINT StartLocation;
|
||||
static WNDPROC OldWndProc;
|
||||
|
||||
// General
|
||||
static PH_STRINGREF CurrentUserRunKeyName = PH_STRINGREF_INIT(L"Software\\Microsoft\\Windows\\CurrentVersion\\Run");
|
||||
@@ -261,8 +263,7 @@ static VOID PhpPageInit(
|
||||
RECT rect;
|
||||
|
||||
optionsWindow = GetParent(hwndDlg);
|
||||
OldWndProc = (WNDPROC)GetWindowLongPtr(optionsWindow, GWLP_WNDPROC);
|
||||
SetWindowLongPtr(optionsWindow, GWLP_WNDPROC, (LONG_PTR)PhpOptionsWndProc);
|
||||
SetWindowSubclass(optionsWindow, PhpOptionsWndProc, 0, 0);
|
||||
|
||||
// Create the Reset button.
|
||||
GetClientRect(optionsWindow, &clientRect);
|
||||
@@ -306,11 +307,16 @@ LRESULT CALLBACK PhpOptionsWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
RemoveWindowSubclass(hwnd, PhpOptionsWndProc, uIdSubclass);
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
@@ -348,7 +354,7 @@ LRESULT CALLBACK PhpOptionsWndProc(
|
||||
break;
|
||||
}
|
||||
|
||||
return CallWindowProc(OldWndProc, hwnd, uMsg, wParam, lParam);
|
||||
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
#define SetDlgItemCheckForSetting(hwndDlg, Id, Name) \
|
||||
|
||||
+17
-40
@@ -3,6 +3,7 @@
|
||||
* System Information window
|
||||
*
|
||||
* Copyright (C) 2011-2016 wj32
|
||||
* Copyright (C) 2017 dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
@@ -73,7 +74,6 @@ static PPH_SYSINFO_SECTION CurrentSection;
|
||||
static HWND ContainerControl;
|
||||
static HWND SeparatorControl;
|
||||
static HWND RestoreSummaryControl;
|
||||
static WNDPROC RestoreSummaryControlOldWndProc;
|
||||
static BOOLEAN RestoreSummaryControlHot;
|
||||
static BOOLEAN RestoreSummaryControlHasFocus;
|
||||
|
||||
@@ -412,8 +412,8 @@ VOID PhSipOnShowWindow(
|
||||
PhInstanceHandle,
|
||||
NULL
|
||||
);
|
||||
RestoreSummaryControlOldWndProc = (WNDPROC)GetWindowLongPtr(RestoreSummaryControl, GWLP_WNDPROC);
|
||||
SetWindowLongPtr(RestoreSummaryControl, GWLP_WNDPROC, (LONG_PTR)PhSipPanelHookWndProc);
|
||||
|
||||
SetWindowSubclass(RestoreSummaryControl, PhSipPanelHookWndProc, 0, 0);
|
||||
RestoreSummaryControlHot = FALSE;
|
||||
|
||||
EnableThemeDialogTexture(ContainerControl, ETDT_ENABLETAB);
|
||||
@@ -1117,13 +1117,8 @@ PPH_SYSINFO_SECTION PhSipCreateSection(
|
||||
NULL
|
||||
);
|
||||
|
||||
SetProp(section->GraphHandle, PhMakeContextAtom(), section);
|
||||
section->GraphOldWndProc = (WNDPROC)GetWindowLongPtr(section->GraphHandle, GWLP_WNDPROC);
|
||||
SetWindowLongPtr(section->GraphHandle, GWLP_WNDPROC, (LONG_PTR)PhSipGraphHookWndProc);
|
||||
|
||||
SetProp(section->PanelHandle, PhMakeContextAtom(), section);
|
||||
section->PanelOldWndProc = (WNDPROC)GetWindowLongPtr(section->PanelHandle, GWLP_WNDPROC);
|
||||
SetWindowLongPtr(section->PanelHandle, GWLP_WNDPROC, (LONG_PTR)PhSipPanelHookWndProc);
|
||||
SetWindowSubclass(section->GraphHandle, PhSipGraphHookWndProc, 0, (ULONG_PTR)section);
|
||||
SetWindowSubclass(section->PanelHandle, PhSipPanelHookWndProc, 0, (ULONG_PTR)section);
|
||||
|
||||
PhAddItemList(SectionList, section);
|
||||
|
||||
@@ -1686,26 +1681,17 @@ LRESULT CALLBACK PhSipGraphHookWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
)
|
||||
{
|
||||
WNDPROC oldWndProc;
|
||||
PPH_SYSINFO_SECTION section;
|
||||
|
||||
section = GetProp(hwnd, PhMakeContextAtom());
|
||||
|
||||
if (!section)
|
||||
return 0;
|
||||
|
||||
oldWndProc = section->GraphOldWndProc;
|
||||
PPH_SYSINFO_SECTION section = (PPH_SYSINFO_SECTION)dwRefData;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
{
|
||||
RemoveProp(hwnd, PhMakeContextAtom());
|
||||
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
|
||||
}
|
||||
RemoveWindowSubclass(hwnd, PhSipGraphHookWndProc, uIdSubclass);
|
||||
break;
|
||||
case WM_SETFOCUS:
|
||||
section->HasFocus = TRUE;
|
||||
@@ -1841,33 +1827,24 @@ LRESULT CALLBACK PhSipGraphHookWndProc(
|
||||
break;
|
||||
}
|
||||
|
||||
return CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);
|
||||
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK PhSipPanelHookWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
)
|
||||
{
|
||||
WNDPROC oldWndProc;
|
||||
PPH_SYSINFO_SECTION section;
|
||||
|
||||
section = GetProp(hwnd, PhMakeContextAtom());
|
||||
|
||||
if (section)
|
||||
oldWndProc = section->PanelOldWndProc;
|
||||
else
|
||||
oldWndProc = RestoreSummaryControlOldWndProc;
|
||||
PPH_SYSINFO_SECTION section = (PPH_SYSINFO_SECTION)dwRefData;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
{
|
||||
RemoveProp(hwnd, PhMakeContextAtom());
|
||||
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
|
||||
}
|
||||
RemoveWindowSubclass(hwnd, PhSipPanelHookWndProc, uIdSubclass);
|
||||
break;
|
||||
case WM_SETFOCUS:
|
||||
{
|
||||
@@ -1971,7 +1948,7 @@ LRESULT CALLBACK PhSipPanelHookWndProc(
|
||||
break;
|
||||
}
|
||||
|
||||
return CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);
|
||||
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
VOID PhSipUpdateThemeData(
|
||||
|
||||
+1
-1
@@ -132,8 +132,8 @@ LRESULT CALLBACK PhpColorBoxWndProc(
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
{
|
||||
PhpFreeColorBoxContext(context);
|
||||
SetWindowLongPtr(hwnd, 0, (LONG_PTR)NULL);
|
||||
PhpFreeColorBoxContext(context);
|
||||
}
|
||||
break;
|
||||
case WM_PAINT:
|
||||
|
||||
+20
-32
@@ -3,6 +3,7 @@
|
||||
* extended list view
|
||||
*
|
||||
* Copyright (C) 2010-2012 wj32
|
||||
* Copyright (C) 2017 dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
@@ -37,7 +38,6 @@
|
||||
typedef struct _PH_EXTLV_CONTEXT
|
||||
{
|
||||
HWND Handle;
|
||||
WNDPROC OldWndProc;
|
||||
PVOID Context;
|
||||
|
||||
// Sorting
|
||||
@@ -66,7 +66,9 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
);
|
||||
|
||||
INT PhpExtendedListViewCompareFunc(
|
||||
@@ -98,13 +100,6 @@ INT PhpDefaultCompareListViewItems(
|
||||
_In_ ULONG Column
|
||||
);
|
||||
|
||||
static PWSTR PhpMakeExtLvContextAtom(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
PH_DEFINE_MAKE_ATOM(L"PhLib_ExtLvContext");
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables extended list view support for a list view control.
|
||||
*
|
||||
@@ -114,16 +109,11 @@ VOID PhSetExtendedListView(
|
||||
_In_ HWND hWnd
|
||||
)
|
||||
{
|
||||
WNDPROC oldWndProc;
|
||||
PPH_EXTLV_CONTEXT context;
|
||||
|
||||
oldWndProc = (WNDPROC)GetWindowLongPtr(hWnd, GWLP_WNDPROC);
|
||||
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)PhpExtendedListViewWndProc);
|
||||
|
||||
context = PhAllocate(sizeof(PH_EXTLV_CONTEXT));
|
||||
|
||||
context->Handle = hWnd;
|
||||
context->OldWndProc = oldWndProc;
|
||||
context->Context = NULL;
|
||||
context->TriState = FALSE;
|
||||
context->SortColumn = 0;
|
||||
@@ -139,7 +129,7 @@ VOID PhSetExtendedListView(
|
||||
context->EnableRedraw = 1;
|
||||
context->Cursor = NULL;
|
||||
|
||||
SetProp(hWnd, PhpMakeExtLvContextAtom(), (HANDLE)context);
|
||||
SetWindowSubclass(hWnd, PhpExtendedListViewWndProc, 0, (ULONG_PTR)context);
|
||||
|
||||
ExtendedListView_Init(hWnd);
|
||||
}
|
||||
@@ -148,22 +138,20 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
)
|
||||
{
|
||||
PPH_EXTLV_CONTEXT context;
|
||||
WNDPROC oldWndProc;
|
||||
|
||||
context = (PPH_EXTLV_CONTEXT)GetProp(hwnd, PhpMakeExtLvContextAtom());
|
||||
oldWndProc = context->OldWndProc;
|
||||
PPH_EXTLV_CONTEXT context = (PPH_EXTLV_CONTEXT)dwRefData;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
{
|
||||
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
|
||||
RemoveWindowSubclass(hwnd, PhpExtendedListViewWndProc, uIdSubclass);
|
||||
|
||||
PhFree(context);
|
||||
RemoveProp(hwnd, PhpMakeExtLvContextAtom());
|
||||
}
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
@@ -176,7 +164,7 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
|
||||
{
|
||||
HWND headerHandle;
|
||||
|
||||
headerHandle = (HWND)CallWindowProc(context->OldWndProc, hwnd, LVM_GETHEADER, 0, 0);
|
||||
headerHandle = (HWND)DefWindowProc(hwnd, LVM_GETHEADER, 0, 0);
|
||||
|
||||
if (header->hwndFrom == headerHandle)
|
||||
{
|
||||
@@ -364,7 +352,7 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
|
||||
{
|
||||
if (i != column)
|
||||
{
|
||||
if (CallWindowProc(oldWndProc, hwnd, LVM_GETCOLUMN, i, (LPARAM)&lvColumn))
|
||||
if (DefWindowProc(hwnd, LVM_GETCOLUMN, i, (LPARAM)&lvColumn))
|
||||
{
|
||||
availableWidth -= lvColumn.cx;
|
||||
}
|
||||
@@ -378,10 +366,10 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
|
||||
}
|
||||
|
||||
if (availableWidth >= 40)
|
||||
return CallWindowProc(oldWndProc, hwnd, LVM_SETCOLUMNWIDTH, column, availableWidth);
|
||||
return DefWindowProc(hwnd, LVM_SETCOLUMNWIDTH, column, availableWidth);
|
||||
}
|
||||
|
||||
return CallWindowProc(oldWndProc, hwnd, LVM_SETCOLUMNWIDTH, column, width);
|
||||
return DefWindowProc(hwnd, LVM_SETCOLUMNWIDTH, column, width);
|
||||
}
|
||||
break;
|
||||
case ELVM_SETCOMPAREFUNCTION:
|
||||
@@ -483,7 +471,7 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);
|
||||
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -565,9 +553,9 @@ static INT PhpExtendedListViewCompareFunc(
|
||||
// use GetProp. This calls NtUserGetProp, and obviously having a system call in a comparison
|
||||
// function is very, very bad for performance.
|
||||
|
||||
if (!CallWindowProc(context->OldWndProc, context->Handle, LVM_GETITEM, 0, (LPARAM)&xItem))
|
||||
if (!DefWindowProc(context->Handle, LVM_GETITEM, 0, (LPARAM)&xItem))
|
||||
return 0;
|
||||
if (!CallWindowProc(context->OldWndProc, context->Handle, LVM_GETITEM, 0, (LPARAM)&yItem))
|
||||
if (!DefWindowProc(context->Handle, LVM_GETITEM, 0, (LPARAM)&yItem))
|
||||
return 0;
|
||||
|
||||
// First, do tri-state sorting.
|
||||
@@ -729,7 +717,7 @@ static INT PhpDefaultCompareListViewItems(
|
||||
item.cchTextMax = 260;
|
||||
|
||||
xText[0] = 0;
|
||||
CallWindowProc(Context->OldWndProc, Context->Handle, LVM_GETITEM, 0, (LPARAM)&item);
|
||||
DefWindowProc(Context->Handle, LVM_GETITEM, 0, (LPARAM)&item);
|
||||
|
||||
// Get the Y item text.
|
||||
|
||||
@@ -738,7 +726,7 @@ static INT PhpDefaultCompareListViewItems(
|
||||
item.cchTextMax = 260;
|
||||
|
||||
yText[0] = 0;
|
||||
CallWindowProc(Context->OldWndProc, Context->Handle, LVM_GETITEM, 0, (LPARAM)&item);
|
||||
DefWindowProc(Context->Handle, LVM_GETITEM, 0, (LPARAM)&item);
|
||||
|
||||
// Compare them.
|
||||
|
||||
|
||||
+2
-1
@@ -926,13 +926,14 @@ LRESULT CALLBACK PhpGraphWndProc(
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
{
|
||||
SetWindowLongPtr(hwnd, 0, (LONG_PTR)NULL);
|
||||
|
||||
if (context->TooltipHandle)
|
||||
DestroyWindow(context->TooltipHandle);
|
||||
|
||||
PhpDeleteFadeOutContext(context);
|
||||
PhpDeleteBufferedContext(context);
|
||||
PhpFreeGraphContext(context);
|
||||
SetWindowLongPtr(hwnd, 0, (LONG_PTR)NULL);
|
||||
}
|
||||
break;
|
||||
case WM_STYLECHANGED:
|
||||
|
||||
@@ -132,6 +132,7 @@ LRESULT CALLBACK PhpHexEditWndProc(
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
{
|
||||
SetWindowLongPtr(hwnd, 0, (LONG_PTR)NULL);
|
||||
PhpFreeHexEditContext(context);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -129,8 +129,6 @@ typedef struct _PH_TREENEW_CONTEXT
|
||||
HFONT TooltipFont;
|
||||
HFONT NewTooltipFont;
|
||||
ULONG TooltipColumnId;
|
||||
WNDPROC FixedHeaderOldWndProc;
|
||||
WNDPROC HeaderOldWndProc;
|
||||
|
||||
TEXTMETRIC TextMetrics;
|
||||
HTHEME ThemeData;
|
||||
@@ -722,15 +720,14 @@ VOID PhTnpGetHeaderTooltipText(
|
||||
_Out_ PWSTR *Text
|
||||
);
|
||||
|
||||
PWSTR PhTnpMakeContextAtom(
|
||||
VOID
|
||||
);
|
||||
|
||||
LRESULT CALLBACK PhTnpHeaderHookWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
);
|
||||
|
||||
// Drag selection
|
||||
|
||||
+9
-29
@@ -3,6 +3,7 @@
|
||||
* tree new (tree list control)
|
||||
*
|
||||
* Copyright (C) 2011-2016 wj32
|
||||
* Copyright (C) 2017 dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
@@ -5774,12 +5775,8 @@ VOID PhTnpInitializeTooltips(
|
||||
|
||||
// Hook the header control window procedures so we can forward mouse messages to the tooltip
|
||||
// control.
|
||||
Context->FixedHeaderOldWndProc = (WNDPROC)GetWindowLongPtr(Context->FixedHeaderHandle, GWLP_WNDPROC);
|
||||
SetProp(Context->FixedHeaderHandle, PhTnpMakeContextAtom(), (HANDLE)Context);
|
||||
SetWindowLongPtr(Context->FixedHeaderHandle, GWLP_WNDPROC, (LONG_PTR)PhTnpHeaderHookWndProc);
|
||||
Context->HeaderOldWndProc = (WNDPROC)GetWindowLongPtr(Context->HeaderHandle, GWLP_WNDPROC);
|
||||
SetProp(Context->HeaderHandle, PhTnpMakeContextAtom(), (HANDLE)Context);
|
||||
SetWindowLongPtr(Context->HeaderHandle, GWLP_WNDPROC, (LONG_PTR)PhTnpHeaderHookWndProc);
|
||||
SetWindowSubclass(Context->FixedHeaderHandle, PhTnpHeaderHookWndProc, 0, (ULONG_PTR)Context);
|
||||
SetWindowSubclass(Context->HeaderHandle, PhTnpHeaderHookWndProc, 0, (ULONG_PTR)Context);
|
||||
|
||||
SendMessage(Context->TooltipsHandle, TTM_SETMAXTIPWIDTH, 0, MAXSHORT); // no limit
|
||||
SendMessage(Context->TooltipsHandle, WM_SETFONT, (WPARAM)Context->Font, FALSE);
|
||||
@@ -6066,38 +6063,21 @@ VOID PhTnpGetHeaderTooltipText(
|
||||
SendMessage(Context->TooltipsHandle, TTM_SETMAXTIPWIDTH, 0, TNP_TOOLTIPS_DEFAULT_MAXIMUM_WIDTH);
|
||||
}
|
||||
|
||||
PWSTR PhTnpMakeContextAtom(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
PH_DEFINE_MAKE_ATOM(L"PhLib_TreeNewContext");
|
||||
}
|
||||
|
||||
LRESULT CALLBACK PhTnpHeaderHookWndProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
)
|
||||
{
|
||||
PPH_TREENEW_CONTEXT context;
|
||||
WNDPROC oldWndProc;
|
||||
|
||||
context = (PPH_TREENEW_CONTEXT)GetProp(hwnd, PhTnpMakeContextAtom());
|
||||
|
||||
if (hwnd == context->FixedHeaderHandle)
|
||||
oldWndProc = context->FixedHeaderOldWndProc;
|
||||
else
|
||||
oldWndProc = context->HeaderOldWndProc;
|
||||
PPH_TREENEW_CONTEXT context = (PPH_TREENEW_CONTEXT)dwRefData;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
{
|
||||
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
|
||||
|
||||
RemoveProp(hwnd, PhTnpMakeContextAtom());
|
||||
}
|
||||
RemoveWindowSubclass(hwnd, PhTnpHeaderHookWndProc, uIdSubclass);
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
@@ -6183,7 +6163,7 @@ LRESULT CALLBACK PhTnpHeaderHookWndProc(
|
||||
break;
|
||||
}
|
||||
|
||||
return CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);
|
||||
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
BOOLEAN PhTnpDetectDrag(
|
||||
|
||||
+3
-13
@@ -145,11 +145,9 @@ INT CALLBACK PvpPropSheetProc(
|
||||
propSheetContext = PhAllocate(sizeof(PV_PROPSHEETCONTEXT));
|
||||
memset(propSheetContext, 0, sizeof(PV_PROPSHEETCONTEXT));
|
||||
|
||||
SetProp(hwndDlg, L"PvContext", (HANDLE)propSheetContext);
|
||||
|
||||
PhInitializeLayoutManager(&propSheetContext->LayoutManager, hwndDlg);
|
||||
|
||||
SetWindowSubclass(hwndDlg, PvpPropSheetWndProc, 0, 0);
|
||||
SetWindowSubclass(hwndDlg, PvpPropSheetWndProc, 0, (ULONG_PTR)propSheetContext);
|
||||
|
||||
if (MinimumSize.left == -1)
|
||||
{
|
||||
@@ -170,13 +168,6 @@ INT CALLBACK PvpPropSheetProc(
|
||||
return 0;
|
||||
}
|
||||
|
||||
PPV_PROPSHEETCONTEXT PvpGetPropSheetContext(
|
||||
_In_ HWND hwnd
|
||||
)
|
||||
{
|
||||
return (PPV_PROPSHEETCONTEXT)GetProp(hwnd, L"PvContext");
|
||||
}
|
||||
|
||||
LRESULT CALLBACK PvpPropSheetWndProc(
|
||||
_In_ HWND hWnd,
|
||||
_In_ UINT uMsg,
|
||||
@@ -186,16 +177,15 @@ LRESULT CALLBACK PvpPropSheetWndProc(
|
||||
_In_ ULONG_PTR dwRefData
|
||||
)
|
||||
{
|
||||
PPV_PROPSHEETCONTEXT propSheetContext = PvpGetPropSheetContext(hWnd);
|
||||
PPV_PROPSHEETCONTEXT propSheetContext = dwRefData;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_NCDESTROY:
|
||||
{
|
||||
RemoveWindowSubclass(hWnd, PvpPropSheetWndProc, uIdSubclass);
|
||||
PhDeleteLayoutManager(&propSheetContext->LayoutManager);
|
||||
|
||||
RemoveProp(hWnd, L"PvContext");
|
||||
PhDeleteLayoutManager(&propSheetContext->LayoutManager);
|
||||
PhFree(propSheetContext);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user