我试图制作自己的即时通信工具,并希望如果电脑长时间未使用,用户进入空闲/离开模式。有没有人有一个好主意如何做到这一点?
如何在VB6中判断系统状态是否为闲置、睡眠等。
原标题:
问题回答
这是我几年前实现此功能的方法。函数fnIdleTime将告诉您自用户上次触摸鼠标或键盘以来已经过去了多少秒。
Public Declare Function timeGetTime Lib "WINMM.DLL" () As Long
Private Type LASTINPUTINFO
cbSize As Long
dwTime As Long
End Type
Public Declare Function GetLastInputInfo Lib "user32.dll" (plii As LASTINPUTINFO) As Long
Public Function fnIdleTime() As Long
Dim lii As LASTINPUTINFO
lii.cbSize = Len(lii)
If (GetLastInputInfo(lii) > 0) Then
fnIdleTime = (timeGetTime - lii.dwTime) 1000
End If
End Function
相关问题
热门标签
- winforms
- combobox
- fogbugz
- java
- date
- internationalization
- asp.net
- iis
- url-rewriting
- urlrewriter
- c#
- enums
- ocaml
- haxe
- algorithm
- string
- viewstate
- .net
- c++
- c
- symbol-table
- mysql
- database
- postgresql
- licensing
- migration
- vb.net
- vb6
- declaration
- vb6-migration
- python
- psycopg2
- backup
- vmware
- virtualization
- gnu-screen
- authentication
- desktop
- excel
- xll
- cultureinfo
- regioninfo
- oracle
- client
- session
- download
- html
- virtual
- constructor
- scenarios
- perl
- full-text-search
- javascript
- ajax
- testing
- oop
- inheritance
- vim
- encapsulation
- information-hiding