GLOBAL OFFENSIVE SECURITY HACKERS
Anonymous Philippines
Anonymous General Santos
Anonymous Davao
MeowSec

Join the forum, it's quick and easy

GLOBAL OFFENSIVE SECURITY HACKERS
Anonymous Philippines
Anonymous General Santos
Anonymous Davao
MeowSec
GLOBAL OFFENSIVE SECURITY HACKERS
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Log in

I forgot my password

Latest topics
» Windows 7 Ultimate SP1 x64 Hydra -Team OS-
by Zaisen Tue Dec 24, 2019 10:27 am

» Windows 10 Pro x64 1909 Fortresses
by Zaisen Tue Dec 24, 2019 10:00 am

» ANDROID MULTI TOOL V1.02B
by Sphere Mon Apr 22, 2019 6:21 pm

» GSD ANDROID TOOL
by Sphere Mon Apr 22, 2019 6:01 pm

» Hard Disk Sentinel Pro 5.30.6 + CRACK
by Sphere Tue Apr 16, 2019 9:20 am

» DEEP FREEZE v7.22 + KEY
by Sphere Tue Apr 16, 2019 8:57 am

» KMS SERVER WINDOWS ACTIVATOR
by Sphere Fri Apr 12, 2019 10:53 am

» Nck AndroidMTK Setup 2562 Pass-GSMXTEAM
by Sphere Thu Mar 28, 2019 6:50 pm

» Windows could not complete the installation. To install Windows on this computer
by Sphere Thu Mar 28, 2019 6:30 pm

» MTK FRP BYPASS TOOL
by Sphere Thu Mar 07, 2019 5:13 pm

» Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET
by Sphere Wed Jan 23, 2019 5:50 pm

» Termux (Facebook-Bruteforce)
by Sphere Tue Jan 08, 2019 12:10 pm

» VIRUS MAKER!
by Sphere Tue Jan 08, 2019 11:35 am

» [Help] How to use Termux??
by Sphere Mon Nov 05, 2018 8:17 pm

» Http Injector
by tiel123 Mon Oct 08, 2018 12:37 pm

Ads

    No ads available.


    Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET

    Go down

    Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET Empty Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET

    Post by Sphere Mon Jan 21, 2019 9:17 pm

    Code:
    Imports System.Runtime.InteropServices

    Public Class Form1
        Private hEvent As IntPtr = IntPtr.Zero
        Private PowerOffTime As Date

        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Timer1.Interval = 5000
            hEvent = RegisterPowerSettingNotification(Me.Handle, GUID_CONSOLE_DISPLAY_STATE, DEVICE_NOTIFY_WINDOW_HANDLE)
        End Sub

        Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
            UnregisterPowerSettingNotification(hEvent)
        End Sub

        Protected Overrides Sub WndProc(ByRef m As Message)
            MyBase.WndProc(m)
            If m.Msg = WM_POWERBROADCAST AndAlso m.WParam.ToInt32 = PBT_POWERSETTINGCHANGE Then
                Dim pbs As POWERBROADCAST_SETTING = CType(m.GetLParam(GetType(POWERBROADCAST_SETTING)), POWERBROADCAST_SETTING)

                'pbs.Data(0) will be 0-2 meaning --> (0 = Monitor Turned Off) (1 = Monitor Turned On) (2 = Monitor Entered 'Dimmed' State)

                If pbs.Data(0) = 0 Then PowerOffTime = Now
                Timer1.Enabled = (pbs.Data(0) = 0) 'enable timer if monitor is turned off | disable timer if monitor is turned on
            End If
        End Sub

        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            Dim ts As TimeSpan = Now - PowerOffTime
            If ts.TotalMinutes >= 5.0 Then 'if it has been 5 minutes...
                Timer1.Stop()
                'Monitor Power Has Been Off For 5 Minutes, start shutdown...
                Me.Close()
            End If
        End Sub

    #Region "Native Methods"
        <StructLayout(LayoutKind.Sequential)>
        Private Structure POWERBROADCAST_SETTING
            Public PowerSetting As Guid
            Public DataLength As Integer
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Data As Byte()
        End Structure

        Private Const WM_POWERBROADCAST As Integer = &H218
        Private Const PBT_POWERSETTINGCHANGE As Integer = &H8013
        Private Const DEVICE_NOTIFY_WINDOW_HANDLE As Integer = &H0
        Private GUID_CONSOLE_DISPLAY_STATE As New Guid("6fe69556-704a-47a0-8f24-c28d936fda47") 'See --> https://msdn.microsoft.com/en-us/library/windows/desktop/hh448380%28v=vs.85%29.aspx

        <DllImport("User32.dll")>
        Private Shared Function RegisterPowerSettingNotification(hRecipient As IntPtr, ByRef NotificationFilter As Guid, Flags As Integer) As IntPtr
        End Function

        <DllImport("User32.dll")>
        Private Shared Function UnregisterPowerSettingNotification(ByVal Handle As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
        End Function
    #End Region
    End Class
    Sphere
    Sphere
    Master Admin
    Master Admin

    Moods : Nature
    Posts : 64
    Join date : 2017-09-08

    https://eliteph.forumotion.com

    Back to top Go down

    Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET Empty Re: Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET

    Post by Sphere Tue Jan 22, 2019 6:29 pm

    Sphere
    Sphere
    Master Admin
    Master Admin

    Moods : Nature
    Posts : 64
    Join date : 2017-09-08

    https://eliteph.forumotion.com

    Back to top Go down

    Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET Empty Re: Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET

    Post by Sphere Tue Jan 22, 2019 6:29 pm

    Sphere
    Sphere
    Master Admin
    Master Admin

    Moods : Nature
    Posts : 64
    Join date : 2017-09-08

    https://eliteph.forumotion.com

    Back to top Go down

    Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET Empty Re: Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET

    Post by Sphere Wed Jan 23, 2019 5:50 pm

    Sphere
    Sphere
    Master Admin
    Master Admin

    Moods : Nature
    Posts : 64
    Join date : 2017-09-08

    https://eliteph.forumotion.com

    Back to top Go down

    Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET Empty Re: Shutdown the PC if the monitor is turned off or not connected (VGA / HDMI) within a period of time. #VB.NET

    Post by Sponsored content


    Sponsored content


    Back to top Go down

    Back to top


     
    Permissions in this forum:
    You cannot reply to topics in this forum