【问题标题】:Prevent DirectX Fullscreen interruption.防止 DirectX 全屏中断。
【发布时间】:2014-02-03 12:17:17
【问题描述】:

我正在使用sharpdx 的工具包制作一个全屏directx 11 窗口。

现在每当另一个应用程序打开一个窗口时,这个全屏就会丢失。 (例如,来自 Skype 的弹出窗口、错误消息……)

我已经看到其他游戏可以以某种方式避免这种情况,所以我想知道这是否也可以使用 sharpdx 工具包,如果可以,如何?

如果工具包无法实现,那么如何使用 directx 11 函数来完成?

谢谢!

【问题讨论】:

    标签: .net fullscreen directx-11 sharpdx


    【解决方案1】:

    我在不久前创建的 XNA 应用程序中遇到了类似的问题。我使用 Windows API PInvoke 取得了一些成功。

    MSDN

    private static class NativeMethods
    {
        [DllImport("user32.dll", SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool LockSetForegroundWindow(uint uLockCode);
        public static readonly uint LSFW_LOCK = 1;
        public static readonly uint LSFW_UNLOCK = 2;
    }
    
    // Prevent annoying windows notifications etc from stealing focus and ruining the show!
    NativeMethods.LockSetForegroundWindow(NativeMethods.LSFW_LOCK);
    

    【讨论】:

      猜你喜欢
      • 2011-12-28
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多