-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
137 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace WindowsTools.WindowsAPI.ComTypes | ||
{ | ||
/// <summary> | ||
/// 使应用能够 (与此接口关联的 CoreWindow) 获取窗口的窗口句柄。 | ||
/// </summary> | ||
[ComImport, Guid("45D64A29-A63E-4CB6-B498-5781D298CB4F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | ||
public partial interface ICoreWindowInterop | ||
{ | ||
/// <summary> | ||
/// 获取应用的 CoreWindow (HWND) 句柄。 | ||
/// </summary> | ||
/// <param name="hwnd">CoreWindow 的窗口句柄</param> | ||
/// <returns>此方法返回 HRESULT 成功或错误代码。</returns> | ||
[PreserveSig] | ||
int GetWindowHandle(out IntPtr hwnd); | ||
|
||
/// <summary> | ||
/// 设置是否已处理到 CoreWindow 的消息。此属性是只写的。 | ||
/// </summary> | ||
/// <param name="value">标志该消息是否已被处理</param> | ||
/// <returns>此方法返回 HRESULT 成功或错误代码。</returns> | ||
[PreserveSig] | ||
int SetMessageHandled([MarshalAs(UnmanagedType.Bool)] bool value); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
WindowsTools/WindowsAPI/ComTypes/IDesktopWindowXamlSourceNative2.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,34 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace WindowsTools.WindowsAPI.ComTypes | ||
{ | ||
[ComImport, Guid("e3dcd8c7-3057-4692-99c3-7b7720afda31"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | ||
public interface IDesktopWindowXamlSourceNative2 | ||
{ | ||
/// <summary> | ||
/// 将当前 IDesktopWindowXamlSourceNative 实例附加到桌面应用中与窗口句柄关联的父 UI 元素。 | ||
/// </summary> | ||
/// <param name="parentWnd">要在其中托管 WinRT XAML 控件的父 UI 元素的窗口句柄。</param> | ||
/// <returns>如果该方法成功,则返回 S_OK。 否则,将返回 HRESULT 错误代码。</returns> | ||
[PreserveSig] | ||
int AttachToWindow(IntPtr parentWnd); | ||
|
||
/// <summary> | ||
/// 获取与当前 IDesktopWindowXamlSourceNative 实例关联的父 UI 元素的窗口句柄。 | ||
/// </summary> | ||
/// <param name="hwnd">在输出时,此参数包含与当前 IDesktopWindowXamlSourceNative 实例关联的父 UI 元素的窗口句柄。</param> | ||
/// <returns>如果该方法成功,则返回 S_OK。 否则,将返回 HRESULT 错误代码。</returns> | ||
[PreserveSig] | ||
int GetWindowHandle(out IntPtr hwnd); | ||
|
||
/// <summary> | ||
/// 使 WinRT XAML 框架能够处理托管 WinRT XAML 控件的 DesktopWindowXamlSource 对象的 Windows 消息。 | ||
/// </summary> | ||
/// <param name="message">要处理的 Windows 消息。</param> | ||
/// <param name="result">如果消息已处理,则为 True;否则为 false。</param> | ||
/// <returns>如果该方法成功,则返回 S_OK。 否则,将返回 HRESULT 错误代码。</returns> | ||
[PreserveSig] | ||
int PreTranslateMessage(ref MSG message, out bool result); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
WindowsTools/WindowsAPI/ComTypes/IXamlSourceTransparency.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,28 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace WindowsTools.WindowsAPI.ComTypes | ||
{ | ||
/// <summary> | ||
/// 获取或设置一个值,该值指定当前线程上所有 DesktopWindowXamlSource 对象的背景是否透明。 | ||
/// </summary> | ||
[ComImport, Guid("06636C29-5A17-458D-8EA2-2422D997A922"), InterfaceType(ComInterfaceType.InterfaceIsIInspectable)] | ||
public interface IXamlSourceTransparency | ||
{ | ||
/// <summary> | ||
/// 获取当前线程上所有 DesktopWindowXamlSource 对象的背景是否透明。 | ||
/// </summary> | ||
/// <param name="isBackgroundTransparent">如果窗口背景透明,则为 true ;否则,为 false.</param> | ||
/// <returns>如果该方法成功,则返回 S_OK。 否则,将返回 HRESULT 错误代码。</returns> | ||
[PreserveSig] | ||
int GetIsBackgroundTransparent([MarshalAs(UnmanagedType.Bool)] out bool isBackgroundTransparent); | ||
|
||
/// <summary> | ||
/// 设置当前线程上所有 DesktopWindowXamlSource 对象的背景是否透明。 | ||
/// </summary> | ||
/// <param name="isBackgroundTransparent">如果窗口背景透明,则为 true ;否则,为 false.</param> | ||
/// <returns>如果该方法成功,则返回 S_OK。 否则,将返回 HRESULT 错误代码。</returns> | ||
[PreserveSig] | ||
int SetIsBackgroundTransparent([MarshalAs(UnmanagedType.Bool)] bool isBackgroundTransparent); | ||
} | ||
} |
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,47 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace WindowsTools.WindowsAPI.ComTypes | ||
{ | ||
/// <summary> | ||
/// 包含来自线程的消息队列的消息信息。 | ||
/// </summary> | ||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] | ||
public struct MSG | ||
{ | ||
/// <summary> | ||
/// 其窗口过程接收消息的窗口的句柄。 当消息是线程消息时,此成员为 NULL 。 | ||
/// </summary> | ||
public IntPtr hwnd; | ||
|
||
/// <summary> | ||
/// 消息的标识符。 应用程序只能使用低字;高字由系统保留。 | ||
/// </summary> | ||
public uint message; | ||
|
||
/// <summary> | ||
/// 关于消息的附加信息。 确切含义取决于 消息 成员的值。 | ||
/// </summary> | ||
public IntPtr wParam; | ||
|
||
/// <summary> | ||
/// 关于消息的附加信息。 确切含义取决于 消息 成员的值。 | ||
/// </summary> | ||
public IntPtr lParam; | ||
|
||
/// <summary> | ||
/// 消息的发布时间。 | ||
/// </summary> | ||
public uint time; | ||
|
||
/// <summary> | ||
/// 发布消息时的光标位置(以屏幕坐标表示)。 | ||
/// </summary> | ||
public int pt_x; | ||
|
||
/// <summary> | ||
/// 发布消息时的光标位置(以屏幕坐标表示)。 | ||
/// </summary> | ||
public int pt_y; | ||
} | ||
} |