none
setwindowdisplayaffinity bug on windows 11 RRS feed

  • 问题

  • 我做了一个程序,目的是阻止edge浏览器被截屏。原理是使用hook的方式,将dll注入msedge.exe中。在dll中获取浏览器的窗口HWND,然后使用setwindowdisplayaffinity(hWnd, WDA_MONITOR)禁止本窗口被截屏。在windows10的系统中,一切正常。但是windows 11(21H2 22000.556)中,无法阻止被截屏(但是我有台win11的虚拟机-版本号相同,却可以防截屏)
    网上看到这个,https://docs.microsoft.com/en-us/answers/questions/700122/setwindowdisplayaffinity-on-windows-11.html,同样的描述,不清楚贵公司是否已确认该问题
    2022年3月17日 2:45

全部回复

  • 您好,

    有问题的程序中返回的错误代码是什么?
    ERROR_NOT_ENOUGH_MEMORY是由于窗口WS_EX_LAYERED 属性。

    Best Regards,
    Minxin Yu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2022年3月18日 8:55
  • 返回就是8 ERROR_NOT_ENOUGH_MEMORY。窗口没有WS_EX_LAYERED属性。同样的代码在windows 7/windows 10下面正常
    2022年3月24日 7:45