LIBClassNew.vb - ClassAutoLogOff

摘要:LIBClassNew.vb - AutoCloseLogOff

這次的版本 比上一個AutoCloseForm 的好
這是質的轉變

花了不少時間找window api
如果知道電腦是idle or not?

 

        Public Sub SetAutoLogOffMainForm(ByVal pform As Form, ByVal piTimeOutInSecond As Integer, ByVal piReminderTimeInSecond As Integer, Optional ByVal pFunc As DFunc0 = Nothing)
            Try
                ClsAutoLogOff = New ClassAutoLogOff

                If Not pFunc Is Nothing Then
                    ClsAutoLogOff.SetFunc(pFunc)
                End If
                ClsAutoLogOff.SetMainForm(pform)
                ClsAutoLogOff.SetTimerInterval(piTimeOutInSecond)
                ClsAutoLogOff.SetReminderTime(piReminderTimeInSecond)
                ClsAutoLogOff.StartTimer()

            Catch Err As Exception
                Call ErrHandler(Err.Message, APP_NAME)
            End Try
        End Sub

        Public Sub SetAutoLogOffSubForm(ByVal pform As System.Windows.Forms.Form)
            Try
                If Not ClsAutoLogOff Is Nothing Then

                    ClsAutoLogOff.SetFrom(pform)
                End If
            Catch Err As Exception
                Call ErrHandler(Err.Message, APP_NAME)
            End Try
        End Sub

        Public Sub FormAutoLogOff(ByVal pform As Form, ByVal piTimeOutInSecond As Integer, ByVal piReminderTimeInSecond As Integer, Optional ByVal pFunc As DFunc0 = Nothing)
            Try
                Dim ClsAutoLogOff As New ClassAutoLogOff

                If Not pFunc Is Nothing Then
                    ClsAutoLogOff.SetFunc(pFunc)
                End If
                ClsAutoLogOff.HasMainFormOnly()
                ClsAutoLogOff.SetMainForm(pform)
                ClsAutoLogOff.SetTimerInterval(piTimeOutInSecond)
                ClsAutoLogOff.SetReminderTime(piReminderTimeInSecond)
                ClsAutoLogOff.StartTimer()

            Catch Err As Exception
                Call ErrHandler(Err.Message, APP_NAME)
            End Try
        End Sub

 

 

" ClassAutoLogOff "

 

 

 

------------------

熱愛生命 喜愛新奇 有趣的事物

 

過去 是無法改變
將來 卻能夠創造

 

希望使大家生活更便利
世界更美好

 

a guy who loves IT and life