mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-08-19 02:33:23 +08:00
- 新增 Platform.Abstractions(接口+NoOp+PlatformLog 日志桥)、 Platform.Windows、Platform.MacOS、Platform.Android 四个项目 - 迁移电源管理、原生对话框、桌面层嵌入、窗口置底/区域穿透、 DWM 互操作、图标服务、包标识查询等全部 Windows P/Invoke 实现 - 主工程保留静态工厂门面,调用点不变;DllImport 扫描为零 - 更新 WindowPassthroughServiceTests 指向新位置(20/20 通过)
31 lines
991 B
C#
31 lines
991 B
C#
using System.Runtime.InteropServices;
|
||
|
||
namespace LanMountainDesktop.Platform.Windows;
|
||
|
||
/// <summary>
|
||
/// Windows 原生消息框(MessageBoxW)封装。
|
||
/// 供宿主在 UI 框架尚不可用(启动早期)时显示诊断信息。
|
||
/// </summary>
|
||
public static class WindowsNativeDialogs
|
||
{
|
||
public const uint Ok = 0x00000000;
|
||
public const uint IconInformation = 0x00000040;
|
||
public const uint IconWarning = 0x00000030;
|
||
|
||
/// <summary>
|
||
/// 显示原生消息框。仅在 Windows 上有效,其他平台为空操作。
|
||
/// </summary>
|
||
public static void Show(string caption, string message, uint type)
|
||
{
|
||
if (!OperatingSystem.IsWindows())
|
||
{
|
||
return;
|
||
}
|
||
|
||
_ = MessageBoxW(IntPtr.Zero, message, caption, type);
|
||
}
|
||
|
||
[DllImport("user32.dll", EntryPoint = "MessageBoxW", CharSet = CharSet.Unicode, SetLastError = true)]
|
||
private static extern int MessageBoxW(IntPtr hWnd, string text, string caption, uint type);
|
||
}
|