mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2025-01-27 08:33:41 +01:00
Start11: Fix "Disable recommended section" to work at 125% display scaling
This commit is contained in:
parent
02cb6e900c
commit
9f9d43e103
@ -517,6 +517,79 @@ void LVT_StartUI_EnableRoundedCorners(HWND hWnd, DWORD dwReceipe, DWORD dwPos, H
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LVT_StartDocked_120DPIHack(int maxHeight)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
Windows_UI_Xaml_IDependencyObject* pRootDependencyObject = NULL;
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
HSTRING_HEADER hshWindowStatics;
|
||||||
|
HSTRING hsWindowStatics = NULL;
|
||||||
|
hr = WindowsCreateStringReference(L"Windows.UI.Xaml.Window", 22, &hshWindowStatics, &hsWindowStatics);
|
||||||
|
if (SUCCEEDED(hr) && hsWindowStatics)
|
||||||
|
{
|
||||||
|
Windows_UI_Xaml_IWindowStatics* pWindowStatics = NULL;
|
||||||
|
hr = RoGetActivationFactory(hsWindowStatics, &IID_Windows_UI_Xaml_IWindowStatics, &pWindowStatics);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
Windows_UI_Xaml_IWindow* pWindow = NULL;
|
||||||
|
hr = pWindowStatics->lpVtbl->get_Current(pWindowStatics, &pWindow);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
IInspectable* pUIElement = NULL;
|
||||||
|
hr = pWindow->lpVtbl->get_Content(pWindow, &pUIElement);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
hr = pUIElement->lpVtbl->QueryInterface(pUIElement, &IID_Windows_UI_Xaml_IDependencyObject, &pRootDependencyObject);
|
||||||
|
|
||||||
|
pUIElement->lpVtbl->Release(pUIElement);
|
||||||
|
}
|
||||||
|
pWindow->lpVtbl->Release(pWindow);
|
||||||
|
}
|
||||||
|
pWindowStatics->lpVtbl->Release(pWindowStatics);
|
||||||
|
}
|
||||||
|
WindowsDeleteString(hsWindowStatics);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pRootDependencyObject)
|
||||||
|
{
|
||||||
|
HSTRING_HEADER hshVisualTreeHelperStatics;
|
||||||
|
HSTRING hsVisualTreeHelperStatics = NULL;
|
||||||
|
hr = WindowsCreateStringReference(L"Windows.UI.Xaml.Media.VisualTreeHelper", 38, &hshVisualTreeHelperStatics, &hsVisualTreeHelperStatics);
|
||||||
|
if (SUCCEEDED(hr) && hsVisualTreeHelperStatics)
|
||||||
|
{
|
||||||
|
Windows_UI_Xaml_IVisualTreeHelperStatics* pVisualTreeHelperStatics = NULL;
|
||||||
|
hr = RoGetActivationFactory(hsVisualTreeHelperStatics, &IID_Windows_UI_Xaml_IVisualTreeHelperStatics, &pVisualTreeHelperStatics);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
Windows_UI_Xaml_IDependencyObject* pStartSizingFrame = LVT_FindChildByClassName(pRootDependencyObject, pVisualTreeHelperStatics, L"StartDocked.StartSizingFrame", NULL);
|
||||||
|
if (pStartSizingFrame)
|
||||||
|
{
|
||||||
|
Windows_UI_Xaml_IUIElement* pIUIElement = NULL;
|
||||||
|
pStartSizingFrame->lpVtbl->QueryInterface(pStartSizingFrame, &IID_Windows_UI_Xaml_IUIElement, &pIUIElement);
|
||||||
|
if (pIUIElement)
|
||||||
|
{
|
||||||
|
Windows_UI_Xaml_IFrameworkElement* pFrameworkElement = NULL;
|
||||||
|
pStartSizingFrame->lpVtbl->QueryInterface(pStartSizingFrame, &IID_Windows_UI_Xaml_IFrameworkElement, &pFrameworkElement);
|
||||||
|
if (pFrameworkElement)
|
||||||
|
{
|
||||||
|
pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Collapsed);
|
||||||
|
pFrameworkElement->lpVtbl->put_MaxHeight(pFrameworkElement, maxHeight);
|
||||||
|
pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Visible);
|
||||||
|
pFrameworkElement->lpVtbl->Release(pFrameworkElement);
|
||||||
|
}
|
||||||
|
pIUIElement->lpVtbl->Release(pIUIElement);
|
||||||
|
}
|
||||||
|
pStartSizingFrame->lpVtbl->Release(pStartSizingFrame);
|
||||||
|
}
|
||||||
|
pVisualTreeHelperStatics->lpVtbl->Release(pVisualTreeHelperStatics);
|
||||||
|
}
|
||||||
|
WindowsDeleteString(hsVisualTreeHelperStatics);
|
||||||
|
}
|
||||||
|
pRootDependencyObject->lpVtbl->Release(pRootDependencyObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reference: https://www.reddit.com/r/Windows11/comments/p1ksou/this_is_not_a_concept_microsoft_in_windows_11/
|
// Reference: https://www.reddit.com/r/Windows11/comments/p1ksou/this_is_not_a_concept_microsoft_in_windows_11/
|
||||||
void LVT_StartDocked_DisableRecommendedSection(HWND hWnd, BOOL bApply, RECT* rect)
|
void LVT_StartDocked_DisableRecommendedSection(HWND hWnd, BOOL bApply, RECT* rect)
|
||||||
{
|
{
|
||||||
@ -604,6 +677,20 @@ void LVT_StartDocked_DisableRecommendedSection(HWND hWnd, BOOL bApply, RECT* rec
|
|||||||
SetRect(&rc, drc.Left, drc.Top, drc.Right, drc.Bottom);
|
SetRect(&rc, drc.Left, drc.Top, drc.Right, drc.Bottom);
|
||||||
SetRect(&rc, MulDiv(rc.left, dpi, 96), MulDiv(rc.top, dpi, 96), MulDiv(rc.right, dpi, 96), MulDiv(rc.bottom, dpi, 96));
|
SetRect(&rc, MulDiv(rc.left, dpi, 96), MulDiv(rc.top, dpi, 96), MulDiv(rc.right, dpi, 96), MulDiv(rc.bottom, dpi, 96));
|
||||||
*rect = rc;
|
*rect = rc;
|
||||||
|
if (bApply && dpi == 120)
|
||||||
|
{
|
||||||
|
HANDLE hRealThreadHandle = NULL;
|
||||||
|
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hRealThreadHandle, THREAD_SET_CONTEXT, FALSE, 0);
|
||||||
|
if (hRealThreadHandle)
|
||||||
|
{
|
||||||
|
QueueUserAPC(LVT_StartDocked_120DPIHack, hRealThreadHandle, 826);
|
||||||
|
CloseHandle(hRealThreadHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pFrameworkElement)
|
||||||
|
{
|
||||||
|
pFrameworkElement->lpVtbl->put_MaxHeight(pFrameworkElement, 726.0);
|
||||||
|
}
|
||||||
if (pFrameworkElement)
|
if (pFrameworkElement)
|
||||||
{
|
{
|
||||||
pFrameworkElement->lpVtbl->Release(pFrameworkElement);
|
pFrameworkElement->lpVtbl->Release(pFrameworkElement);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <roapi.h>
|
#include <roapi.h>
|
||||||
#include <winstring.h>
|
#include <winstring.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <Shlwapi.h>
|
||||||
|
|
||||||
#define LVT_LOC_NONE 0
|
#define LVT_LOC_NONE 0
|
||||||
#define LVT_LOC_BOTTOMLEFT 1
|
#define LVT_LOC_BOTTOMLEFT 1
|
||||||
@ -460,10 +461,12 @@ typedef struct Windows_UI_Xaml_IFrameworkElement_Vtbl
|
|||||||
__RPC__in Windows_UI_Xaml_IFrameworkElement* This);
|
__RPC__in Windows_UI_Xaml_IFrameworkElement* This);
|
||||||
|
|
||||||
HRESULT(STDMETHODCALLTYPE* get_MaxHeight)(
|
HRESULT(STDMETHODCALLTYPE* get_MaxHeight)(
|
||||||
__RPC__in Windows_UI_Xaml_IFrameworkElement* This);
|
__RPC__in Windows_UI_Xaml_IFrameworkElement* This,
|
||||||
|
/* [out] */ __RPC__out DOUBLE* value);
|
||||||
|
|
||||||
HRESULT(STDMETHODCALLTYPE* put_MaxHeight)(
|
HRESULT(STDMETHODCALLTYPE* put_MaxHeight)(
|
||||||
__RPC__in Windows_UI_Xaml_IFrameworkElement* This);
|
__RPC__in Windows_UI_Xaml_IFrameworkElement* This,
|
||||||
|
/* [in] */ __RPC__in DOUBLE value);
|
||||||
|
|
||||||
HRESULT(STDMETHODCALLTYPE* get_HorizontalAlignment)(
|
HRESULT(STDMETHODCALLTYPE* get_HorizontalAlignment)(
|
||||||
__RPC__in Windows_UI_Xaml_IFrameworkElement* This);
|
__RPC__in Windows_UI_Xaml_IFrameworkElement* This);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user