-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Subclass WinUI Window to hook native win32 events (#1687)
* Subclass WinUI Window to hook native win32 events * Make native message id's consts public * Make native message id consts internal
- Loading branch information
Showing
5 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Microsoft.Maui | ||
{ | ||
[ComImport] | ||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | ||
[Guid("EECDBF0E-BAE9-4CB6-A68E-9598E1CB57BB")] | ||
internal interface IWindowNative | ||
{ | ||
IntPtr WindowHandle { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/Core/src/Platform/Windows/WindowsNativeMessageEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
|
||
namespace Microsoft.Maui | ||
{ | ||
public class WindowsNativeMessageEventArgs : EventArgs | ||
{ | ||
public WindowsNativeMessageEventArgs(IntPtr hwnd, uint messageId, IntPtr wParam, IntPtr lParam) | ||
{ | ||
Hwnd = hwnd; | ||
MessageId = messageId; | ||
WParam = wParam; | ||
LParam = lParam; | ||
} | ||
|
||
public IntPtr Hwnd { get; private set; } | ||
public uint MessageId { get; private set; } | ||
public IntPtr WParam { get; private set; } | ||
public IntPtr LParam { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Microsoft.Maui | ||
{ | ||
internal static class WindowsNativeMessageIds | ||
{ | ||
public const int WM_DPICHANGED = 0x02E0; | ||
public const int WM_DISPLAYCHANGE = 0x007E; | ||
public const int WM_SETTINGCHANGE = 0x001A; | ||
public const int WM_THEMECHANGE = 0x031A; | ||
} | ||
} |