Detecting full-screen Direct3D applications
Asked Answered
Y

2

4

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.

Yusem answered 2/8, 2009 at 18:18 Comment(0)
D
2

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...

Discoverer answered 3/8, 2013 at 19:23 Comment(2)
What about after .net 3.5, should CheckDeviceState be used instead ? i.e. This method replaces IDirect3DDevice9::TestCooperativeLevel, which always returns S_OK in Direct3D 9Ex applications.Gonidium
SHQueryUserNotificationState() returns only 3 (QUNS_RUNNING_D3D_FULL_SCREEN) when: a) The window is on the desktop screen/main screen, is a direct3d window, maximized and the taskbar is not visible. When the taskbar is visible it returns 2 (QUNS_BUSY) because, although it is fullscreen/maximized it does not using the whole screen because of the taskbar. It's also returns 2 (QUNS_BUSY) when a normal window/video is maximized on the main screen. A DirectX window start always maximized on the main screen, so if the function returns 3 it's always there. When is on another screen it rerturns 5.Kissner
F
0

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.

Forebear answered 3/8, 2009 at 12:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.