WM_SYSCOMMAND & SC_SCREENSAVE problem 
Author Message
 WM_SYSCOMMAND & SC_SCREENSAVE problem

My application has to detect when the screen saver becomes active.

I override the OnSysCommand and it works fine BUT ONLY if my application is
the active application.
If it is in the background, it doesn't receive the WM_SYSCOMMAND message.

I tried to use SetWindowsHookEx, but it is the same thing, the application
receive the WM_SYSCOMMAND only if it is active.

Does anyone know how to solve the problem? Or have an idea?

Thanks for help.

Didier Fillettaz
S+T Service & Technique S.A.
67, rte du Pas-de-l'Echelle
CH-1255 Veyrier / Geneva
Switzerland



Sat, 11 Aug 2001 03:00:00 GMT  
 WM_SYSCOMMAND & SC_SCREENSAVE problem

Make sure you check the wParam or lParam (i forget which one)...
it is more likely that your application DOES receive WM_SYSCOMMAND but you
don't decode the SC_SCREENSAVE correctly.

Check the docs - the lower 4 bits of the parameter are used internally, so
you must do
case WM_SYSCOMMAND:
  if (wParam & 0xfff0 == SC_SCREENSAVE)
  {
    // whatever
  }
  break;
.
.
.

(like i said, check the docs ... above i used wParam but it might actually
be lParam so i could be wrong)

dave

Quote:

> I override the OnSysCommand and it works fine BUT ONLY if my application is
> the active application.
> If it is in the background, it doesn't receive the WM_SYSCOMMAND message.



Sat, 11 Aug 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. WM_SYSCOMMAND & SC_SCREENSAVE problem

2. Capturing WM_SYSCOMMAND & SC_CLOSE

3. Problem with WM_SYSCOMMAND

4. WTL and WM_SYSCOMMAND

5. WM_SYSCOMMAND crashes in wincore.cpp

6. hook WM_SYSCOMMAND message

7. WM_SYSCOMMAND Trapping

8. WM_SYSCOMMAND

9. WM_SYSCOMMAND crashes in wincore.cpp

10. Q: WM_SYSCOMMAND and SC_HOTKEY

11. WM_SYSCOMMAND

12. CDateTimeCtrl && RUNTIME_CLASS Problem

 

 
Powered by phpBB® Forum Software