Jump to content
  • Advertisement
Sign in to follow this  
spiralmonkey

OpenGL DX causing monitor not to sleep?

This topic is 4646 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, does anyone know of any link between directx and windows NOT sending a WM_SYSCOMMAND / SC_MONITORPOWER? i'm creating a screensaver and watching for these signals. When i run my app in openGL mode the monitor will turn off at the right time, but when in DX8.1 mode windows never seems to send the SC_MONITORPOWER message. If i bypass the pd3dDevice->Present() then it DOES send that message and my monitor goes to sleep. Any ideas? thanks very much, alan

Share this post


Link to post
Share on other sites
Advertisement
Direct3D injects its own window procedure during fullscreen operation. Perhaps it's eating power-saving messages even though it shouldn't - that'd be a bug. Set your own window procedure again after going fullscreen, and make sure you call Direct3D's window procedure from your own somewhere (either at the beginning of your window procedure, or instead of DefWindowProc in the end - I'm not sure).

Share this post


Link to post
Share on other sites
There used to be an article on MSDN about a screensaver framework using DX8. I can't find the article, so it may have be sacrificed to the gods of progress. The download containing the code sample seems to still be there though.

http://www.microsoft.com/downloads/details.aspx?FamilyID=b2886b0b-009b-4007-96c8-5e993d2cf0bb&DisplayLang=en

Share this post


Link to post
Share on other sites
Well, i found the problem. A while ago i changed my screensaver from ending in .scr to ending in .exe. It turns out, if i run the .exe version, it never receives a SC_MONITORPOWER signal, but if i merely rename it to .scr, it does get the signal. This only happens when i run it in Direct3D mode.

anybody know of a possible reason for this?

thanks,
alan

Share this post


Link to post
Share on other sites
Quote:
Original post by spiralmonkey
anybody know of a possible reason for this?

Since that behavior distinctly changed after you altered the exe to a screensaver extension, it must be some behavior built into Windows or the D3D runtime. Perhaps they never want normal, fullscreen D3D apps to sleep, while they think its ok for screensavers to.

Share this post


Link to post
Share on other sites
I wonder if it isn't a hack that was put in place to protect badly written D3D apps from dying when the screensaver kicks in. I know there used to be a LOT of those. Quite a few even mentioned in the ReadMe that you should disable the any screensavers before playing the games.

I really hate hacks like that, but I grudgingly admit the neccessity for them.

Share this post


Link to post
Share on other sites
D3D should not be interfering in screensaver policy -- not sure why you're seeing what your seeing.

However, the correct way to disable the screensaver is to call this API:


SetThreadExecutionState(ES_MONITOR_REQUIRED);



This was recently changed in DXUT. For a long time, DXUT incorrectly used SC_MONITORPOWER but this isn't the right way to disable screensavers.

Jason
DirectX SDK Dev Lead

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!