-
Apr 4th, 2008, 05:17 AM
#1
Thread Starter
Addicted Member
vb6 get user idle time
hi.
i wanna get the user idle time. i used this code
'-------------------------------------------------------
Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function GetLastInputInfo Lib "user32" (plii As Any) As Long
Private Type LASTINPUTINFO
cbSize As Long
dwTime As Long
End Type
Private Sub Timer1_Timer()
Dim lii As LASTINPUTINFO
lii.cbSize = Len(lii)
Call GetLastInputInfo(lii)
With Label1
.Caption = FormatNumber((GetTickCount() - lii.dwTime) / 1000, 2)
.Refresh
End With
If Label1.Caption = "10.00" Then
MsgBox "hi"
End If
End Sub
'---------------------------------------------------------------------
it's works good but not on windows 98.
can anone help me get the idle time in windows 98 too?
thanx.
-
Apr 4th, 2008, 05:25 AM
#2
Re: vb6 get user idle time
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Apr 4th, 2008, 07:12 AM
#3
Re: vb6 get user idle time
Welcome to the forums.
What does it do on Windows 98?
-
Apr 4th, 2008, 07:17 AM
#4
Re: vb6 get user idle time
GetLastInputInfo is not supported on operating systems before Windows 2000. So on Windows 98 it will fail. You need to create (if possible) your own duplicate function to replace the unsupported API.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Apr 4th, 2008, 07:49 AM
#5
Re: vb6 get user idle time
This should work on all OS
System Wide Idle Time - Idle time dll
http://www.developerfusion.co.uk/show/2013/
Also see:
API GetQueueStatus, QS_INPUT = QS_MOUSE Or QS_KEY
http://www.planet-source-code.com/vb...29735&lngWId=1
Check if an Application is Idle for a Period of Time
http://www.freevbcode.com/ShowCode.asp?ID=3297
-
Apr 4th, 2008, 04:52 PM
#6
Thread Starter
Addicted Member
Re: vb6 get user idle time
thanx but it's not work
i want to show the user idle time
-
Apr 4th, 2008, 04:54 PM
#7
Thread Starter
Addicted Member
Re: vb6 get user idle time
heloo hack.
in windows 98 i get error
i user user32 to get the idle time, the function "getlastinfo" not exist in the user32.dll of windows 98!!!
-
Apr 5th, 2008, 05:18 AM
#8
Re: vb6 get user idle time
Originally Posted by yosef_mreh
heloo hack.
in windows 98 i get error
i user user32 to get the idle time, the function "getlastinfo" not exist in the user32.dll of windows 98!!!
Did you see RobDog888's comment?
Originally Posted by RobDog888
GetLastInputInfo is not supported on operating systems before Windows 2000. So on Windows 98 it will fail. You need to create (if possible) your own duplicate function to replace the unsupported API.
-
Apr 5th, 2008, 12:04 PM
#9
Thread Starter
Addicted Member
Re: vb6 get user idle time
it's ok... i know i can do this
but i want the application to run under windows98 too
is any function can return the idle time in windows 98?
-
Nov 19th, 2008, 06:22 AM
#10
New Member
Re: vb6 get user idle time
I think this code exactly suites my requirement. I have implemented this code to find user's idle time. It is working find until now.
I have implemented this on Windows XP
A BIG thanks for providing this code.
Originally Posted by yosef_mreh
hi.
i wanna get the user idle time. i used this code
'-------------------------------------------------------
Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function GetLastInputInfo Lib "user32" (plii As Any) As Long
Private Type LASTINPUTINFO
cbSize As Long
dwTime As Long
End Type
Private Sub Timer1_Timer()
Dim lii As LASTINPUTINFO
lii.cbSize = Len(lii)
Call GetLastInputInfo(lii)
With Label1
.Caption = FormatNumber((GetTickCount() - lii.dwTime) / 1000, 2)
.Refresh
End With
If Label1.Caption = "10.00" Then
MsgBox "hi"
End If
End Sub
'---------------------------------------------------------------------
it's works good but not on windows 98.
can anone help me get the idle time in windows 98 too?
thanx.
-
Nov 19th, 2008, 10:24 AM
#11
Thread Starter
Addicted Member
Re: vb6 get user idle time
no way.
there is no idle time in windows 98.
microsoft ceck the if the mouse replaced or an intrapt from the keyboard. this what microsoft do in windows 98 to run the SCREEN SERVER.
you can do the same thing. replay me if u wanna know how to get the OS using vb6
-
Feb 2nd, 2013, 03:02 AM
#12
Member
Re: vb6 get user idle time
HI yosef_mreh, i need ya help with your timer code too.
can your code detect a user idle states ??
cause im doing an auto logout page for the user if the user is idle, when the user forgot to logout.
can you help me with that cause i'm doing my Final year project, left a fews days!! please help me!! Thanks
-
Feb 2nd, 2013, 03:06 AM
#13
Re: vb6 get user idle time
Originally Posted by fatboycgn
HI yosef_mreh, i need ya help with your timer code too.
Well, considering the thread is over 4 years old I am not sure if the original poster is still active. Your best bet would be to start your own thread and refer to this thread via a link.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Feb 2nd, 2013, 03:25 AM
#14
Member
Re: vb6 get user idle time
okay thanks
-
Nov 20th, 2020, 11:14 AM
#15
New Member
Re: vb6 get user idle time
Originally Posted by yosef_mreh
hi.
i wanna get the user idle time. i used this code
'-------------------------------------------------------
Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function GetLastInputInfo Lib "user32" (plii As Any) As Long
Private Type LASTINPUTINFO
cbSize As Long
dwTime As Long
End Type
Private Sub Timer1_Timer()
Dim lii As LASTINPUTINFO
lii.cbSize = Len(lii)
Call GetLastInputInfo(lii)
With Label1
.Caption = FormatNumber((GetTickCount() - lii.dwTime) / 1000, 2)
.Refresh
End With
If Label1.Caption = "10.00" Then
MsgBox "hi"
End If
End Sub
'---------------------------------------------------------------------
it's works good but not on windows 98.
can anone help me get the idle time in windows 98 too?
thanx.
Its works good
Thanks
-
Nov 20th, 2020, 11:55 AM
#16
Re: vb6 get user idle time
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|