Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First i'll thank you guys for the help, like you said <code>application.idle</code> doesn't work, with you help i got this solution i VB:</p> <pre><code>Imports System Imports Microsoft.Win32 Imports System.Windows.Forms Imports System.Runtime.InteropServices &lt;DllImport("user32.dll", CharSet:=CharSet.Auto)&gt; Public Shared Function SystemParametersInfo(uAction As UInteger, _ uParam As UInteger, ByRef lpvParam As Boolean, fWinIni As Integer) As &lt;MarshalAs(UnmanagedType.Bool)&gt; Boolean End Function ' Check if the screensaver is busy running.' Public Shared Function IsScreensaverRunning() As Boolean Const SPI_GETSCREENSAVERRUNNING As Integer = 114 Dim isRunning As Boolean = False If Not SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, isRunning, 0) Then ' Could not detect screen saver status...' Return False End If If isRunning Then ' Screen saver is ON.' Return True End If ' Screen saver is OFF.' Return False End Function Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Const WM_SYSCOMMAND As Integer = &amp;H112 Const SC_SCREENSAVE As Integer = &amp;HF140 MyBase.WndProc(m) If bloqueado = 0 Then If m.Msg = WM_SYSCOMMAND AndAlso m.WParam.ToInt32 = SC_SCREENSAVE Then Timer2.Start() Timer3.Enabled = True Timer3.Start() 'here we that that the screensaver started running so we start a timer' End If End If End Sub Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick If IsScreensaverRunning() Then 'Screen Saver Is Running' Else Timer3.Stop() Timer3.Enabled = False 'Screen Saver Is not Running' End If End Sub </code></pre> <p>Because the timer only starts running when the screensaver is running we know that when you get timer3.stop is when the screensaver stopped running</p> <p>Important, don't put a msgbox before the timer stop because it wont work, the pop-up will show and it wont get to the stop so innumerous pop-up will appear (yeah... i made that mistake :S)</p> <p>Again, thanks for helping me and hope it will help someone in the future</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload