Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Prevent sleep allow screen saver

$
0
0
Hi I need to allow the screen saver and prevent sleep I am projecting my pc to LCD TV I dont want to burn the image into the TV. I am designing a Andon system for work where if all units are running I need to allow the screen saver and prevent the log off screen. I tried through the control panel but it seemed to alawys log off I found this code on the web that prevents sleep mode but also disables the screen saver. I am using windows 7 and windows 8 the production machiune is windows 8.

'This function queries or sets system-wide parameters, and updates the user profile during the process.

    <DllImport("user32", EntryPoint:="SystemParametersInfo", CharSet:=CharSet.Auto, SetLastError:=True)> _
      Private Shared Function SystemParametersInfo(ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
    End Function
    Private Const SPI_SETSCREENSAVETIMEOUT As Int32 = 15

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        'Sets the screen saver time-out value to the 
        'value of the uiParam parameter. This value is the amount of time, 
        'in seconds, that the system must remain idle before the screen saver activates. 
        'So, if you set it 30, it will suspend the screensaver & Power Off features for 30 minutes
        SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 30, 0, 0)

    End Sub


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>