Detecting full-screen Direct3D applications

瘦欲@ 提交于 2019-12-04 13:26:29

问题


Is there any way to detect - through the Direct3D API - Direct3D applications running in full-screen mode?

SHQueryUserNotificationState, which can indicate such applications, is only supported on Vista and up. It also only works when the Explorer shell is running.


回答1:


I found how to detect full-screen Direct3D and OpenGL (for example Minecraft) applications.

Call IDirectDraw7::TestCooperativeLevel(). This function returns DDERR_EXCLUSIVEMODEALREADYSET if active full-screen Direct3D application is running or if user session is not active (Win+L, Alt+Ctrl+Del, Fast User Switching, etc).

Note: Call DirectDrawCreateEx with DDCREATE_EMULATIONONLY. This dramatically reduces resources usage by IDirectDraw7.

I have tested this method only in Windows 7 SP1 x64 with 1 display.


BTW SHQueryUserNotificationState() returns QUNS_BUSY instead of QUNS_RUNNING_D3D_FULL_SCREEN for full-screen games. Strange...




回答2:


Try 'IDirect3DDevice9::GetDisplayMode':

http://msdn.microsoft.com/en-us/library/bb174387%28VS.85%29.aspx

HRESULT GetDisplayMode(
  UINT  iSwapChain,
  D3DDISPLAYMODE * pMode
);

Parameters:

iSwapChain[in]

An unsigned integer specifying the swap chain. 

pMode[out]

Pointer to a D3DDISPLAYMODE structure containing data about the

display mode of the adapter. As opposed to the display mode of the device, which may not be active if the device does not own full-screen mode.



来源:https://stackoverflow.com/questions/1219454/detecting-full-screen-direct3d-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!