selectgt
asked on
Detecting Full Screen OpenGL/DirectX
What's the most accurate way to detect if a full screen application (Either Open GL or Direct X) is open or not.
I need to be able to detect as soon as the computer goes into full screen mode for an open gl game or directx and then be able to detect as soon as the full screen application is no longer active.
Points will be awarded to the most effective complete solution.
I need to be able to detect as soon as the computer goes into full screen mode for an open gl game or directx and then be able to detect as soon as the full screen application is no longer active.
Points will be awarded to the most effective complete solution.
ASKER
OK then, now the 2nd part. How do I determine if that application is Open GL or Direct X or neither of the 2?
I'm not too sure but I'd reckon on trying to pass a draw function for either to the window's DC. In theory:
- Enumerate all open windows (EnumWindows API)
- Loop through each window (callback routine)
- Get the device context (DC) for the window (GetDC)
- Turn on error skipping (On Error Resume Next)
- Try to execute a D3D command to the DC (?)
- If there is an error, flag D3D as false
- Try to execute a OGL command to the DC (?)
- If there is an error, flag OGL as false
- Determine result from D3D and OGL flags.
That might be wishful thinking, though.
It might be better to determine why you need this function; other methods might be available...
HTH
J.
- Enumerate all open windows (EnumWindows API)
- Loop through each window (callback routine)
- Get the device context (DC) for the window (GetDC)
- Turn on error skipping (On Error Resume Next)
- Try to execute a D3D command to the DC (?)
- If there is an error, flag D3D as false
- Try to execute a OGL command to the DC (?)
- If there is an error, flag OGL as false
- Determine result from D3D and OGL flags.
That might be wishful thinking, though.
It might be better to determine why you need this function; other methods might be available...
HTH
J.
ASKER
The program does constant data processing utilizing, on my test machines, 10-15% of cpu power from 3Ghz processors. When an open gl game or a direct x game is launched, i want it to go idle until it's finished.
Honestly, if anyone can help me solve this problem (with code examples or code solution) in whatever way, I'll still award all of the points and consider it a solution.
Honestly, if anyone can help me solve this problem (with code examples or code solution) in whatever way, I'll still award all of the points and consider it a solution.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I would enumerate the open windows with EnumWindows API, then get the window styles with GetWindowLong API and GetWindowRect API to determine if the width was the screen width, the height wa the screen height and the window had no border or caption.
HTH
J.