mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Compare commits
1 Commits
windows-gr
...
fix/1571
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d631b54b4 |
@@ -48,6 +48,7 @@ internal sealed class WindowSubclass : IDisposable
|
||||
{
|
||||
windowProc = OnSubclassProcedure;
|
||||
bool windowHooked = SetWindowSubclass(options.Hwnd, windowProc, WindowSubclassId, 0);
|
||||
bool propHooked = SetPropW(options.Hwnd, "NonRudeHWND", BOOL.TRUE);
|
||||
hotKeyController.RegisterAll();
|
||||
|
||||
bool titleBarHooked = true;
|
||||
@@ -55,7 +56,7 @@ internal sealed class WindowSubclass : IDisposable
|
||||
// only hook up drag bar proc when use legacy Window.ExtendsContentIntoTitleBar
|
||||
if (!options.UseLegacyDragBarImplementation)
|
||||
{
|
||||
return windowHooked && titleBarHooked;
|
||||
return windowHooked && propHooked && titleBarHooked;
|
||||
}
|
||||
|
||||
titleBarHooked = false;
|
||||
@@ -63,13 +64,13 @@ internal sealed class WindowSubclass : IDisposable
|
||||
|
||||
if (hwndDragBar.IsNull)
|
||||
{
|
||||
return windowHooked && titleBarHooked;
|
||||
return windowHooked && propHooked && titleBarHooked;
|
||||
}
|
||||
|
||||
legacyDragBarProc = OnLegacyDragBarProcedure;
|
||||
titleBarHooked = SetWindowSubclass(hwndDragBar, legacyDragBarProc, DragBarSubclassId, 0);
|
||||
|
||||
return windowHooked && titleBarHooked;
|
||||
return windowHooked && propHooked && titleBarHooked;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -78,6 +79,7 @@ internal sealed class WindowSubclass : IDisposable
|
||||
hotKeyController.UnregisterAll();
|
||||
|
||||
RemoveWindowSubclass(options.Hwnd, windowProc, WindowSubclassId);
|
||||
RemovePropW(options.Hwnd, "NonRudeHWND");
|
||||
windowProc = default!;
|
||||
|
||||
if (options.UseLegacyDragBarImplementation)
|
||||
|
||||
@@ -85,6 +85,19 @@ internal static class User32
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern int ReleaseDC([AllowNull] HWND hWnd, HDC hDC);
|
||||
|
||||
[DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern HANDLE RemovePropW(HWND hWnd, PCWSTR lpString);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe HANDLE RemovePropW(HWND hWnd, string str)
|
||||
{
|
||||
fixed (char* lpString = str)
|
||||
{
|
||||
return RemovePropW(hWnd, lpString);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true, SetLastError = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static unsafe extern uint SendInput(uint cInputs, INPUT* pInputs, int cbSize);
|
||||
@@ -102,6 +115,19 @@ internal static class User32
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern BOOL SetForegroundWindow(HWND hWnd);
|
||||
|
||||
[DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern BOOL SetPropW(HWND hWnd, PCWSTR lpString, [AllowNull] nint hData);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe BOOL SetPropW(HWND hWnd, string str, [AllowNull] nint hData)
|
||||
{
|
||||
fixed (char* lpString = str)
|
||||
{
|
||||
return SetPropW(hWnd, lpString, hData);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern nint SetWindowLongPtrW(HWND hWnd, WINDOW_LONG_PTR_INDEX nIndex, nint dwNewLong);
|
||||
|
||||
Reference in New Issue
Block a user