Home > Software engineering >  How to realize automatic exit is better, please?
How to realize automatic exit is better, please?

Time:09-24

To achieve such a function, it is similar to 10 minutes without any operating out of such an operating system
Now way is to set up a public variables such as LastTime,
A public function, such as the SetTime
The public function of the public variable is set to the current time.
Then make a timer, determine the current time and compare the public variables. Exit when the time is up.


So do the problem is that each new function, all need to call once the SetTime.
Do you have a better way, before each function call, just call SetTime first?

Each function will still have to manually specify?

CodePudding user response:

If it is to check the system operation is not available, simple,
 Private Declare Function GetLastInputInfo Lib "user32" (plii As LASTINPUTINFO) As Boolean 
Private Declare Function GetTickCount Lib "kernel32 () As" Long
Private Type LASTINPUTINFO
CbSize As Long
DwTime As Long
End Type
Dim lii As LASTINPUTINFO


Private Sub Timer1_Timer ()
Lii. CbSize=Len (lii)
GetLastInputInfo lii
The Debug. Print GetTickCount - lii. DwTime & amp; "Ms"
End Sub

CodePudding user response:

The meaning of the original poster should be his own software, not "the system" without operation,
Don't know can HOOK the bottom of the mouse and keyboard messages line no,

CodePudding user response:

10 minutes without any operating
Refer to your software or the entire operating system?

CodePudding user response:

Write a small tool in each process to add a detection function, simple
  • Related