Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi,
I have created the "screen saver" for OS Windows, but it ignores option "turn off monitor" (Display properties -> tab Screen saver -> Power) and running anyway :confused: .

My code based on DirectX SDK example.

I process this messages:
case WM_ACTIVATEAPP:
    if( wParam == FALSE && m_SaverMode != sm_test )
        InterruptSaver();
    break;

case WM_POWERBROADCAST:
    if( wParam == PBT_APMSUSPEND && m_VerifySaverPassword == NULL )
        InterruptSaver();
    break;

case WM_SYSCOMMAND:
    if ( m_SaverMode == sm_full )
    {
        switch ( wParam )
        {
            case SC_NEXTWINDOW:
            case SC_PREVWINDOW:
            case SC_SCREENSAVE:
            case SC_CLOSE:
                return FALSE;
        };
    }
    break;


Thank you.
Posted
Updated 9-Feb-11 1:00am
v4

I have found the problem :) .
In window procedure:
case WM_SYSCOMMAND:

switch ( wParam )
{
case SC_MONITORPOWER:
return DefWindowProc(hWnd, message, wParam, lParam);
//was: return 0;
};
 
Share this answer
 
v2
What happens when you select "turn off monitor". Where in your code do you action that selector, what actions does your code take? Please do not expect people to guess how your code works.
 
Share this answer
 
Comments
Style-7 9-Feb-11 6:20am    
Hi,
Display properties -> tab Screen saver -> Power
I do nothing :). This is must start automatically, but my screen saver is blocked this.
Richard MacCutchan 9-Feb-11 7:02am    
I'm not sure I understand what you are saying here.
Style-7 9-Feb-11 7:31am    
Sorry for my poor English :)
I have found the problem. See below.
Thank you.
www.styleseven.com

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900