Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Disabling Screen Savers
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00117077
Message ID:
00117081
Vues:
19
>Can anyone tell me an easy way to programaticaly disable a screen saver? I have a form that is visible for about an hour while code is processing in the background, and the screen saver kicks in after 5 minutes. I only want to disable the screen saver when the form is not active. Thanks

Hi Mark,

Yes, you can programmatically disable the screen saver. First, however, you should determine if there's one active. Here's the code to do both:
#DEFINE SPI_GETSCREENSAVEACTIVE    16
#DEFINE SPI_SETSCREENSAVEACTIVE    17
* Find out whether or not the screen saver is active
DECLARE SHORT SystemParametersInfo IN Win32API;
  INTEGER uiAction, SHORT uiParam,;
  INTEGER @pvParam, INTEGER fWinIni
lnvparm = 0
STORE .F. TO llresult, llactive
llresult = (SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, @lnvparm, 0) # 0)
IF llresult
  llactive = (lnvparm # 0)
ENDIF
IF llactive
  * Turn if off
  DECLARE SHORT SystemParametersInfo IN Win32API;
     INTEGER uiAction, SHORT uiParam,;
     INTEGER pvParam, INTEGER fWinIni
  = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, 0)
ENDIF
* Processing code here
IF llactive
  * Turn it back on
  = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1, 0, 0)
ENDIF
Please note the differences between the two declarations. These are necessary.

hth,
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform