home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
get_idl
/
testdll.frm
< prev
next >
Wrap
Text File
|
1994-04-11
|
5KB
|
151 lines
VERSION 2.00
Begin Form Testdll
Caption = "Idle Time DLL Test Module"
ClientHeight = 2250
ClientLeft = 1050
ClientTop = 2010
ClientWidth = 4845
Height = 2655
Icon = TESTDLL.FRX:0000
Left = 990
LinkTopic = "Form2"
ScaleHeight = 2250
ScaleWidth = 4845
Top = 1665
Width = 4965
Begin CommandButton buQuit
Cancel = -1 'True
Caption = "&Quit"
Height = 375
Left = 2520
TabIndex = 5
Top = 1560
Width = 2175
End
Begin CommandButton buUserFlag
Caption = "Ignore &USER msgs"
Height = 375
Left = 120
TabIndex = 1
Tag = "0"
Top = 1560
Width = 2175
End
Begin Timer Timer1
Interval = 12
Left = 4200
Top = 480
End
Begin Label lbSecs
BorderStyle = 1 'Fixed Single
Caption = "0"
Height = 255
Left = 2040
TabIndex = 4
Top = 900
Width = 1695
End
Begin Label lbSeconds
Caption = "Seconds Since Last Event"
Height = 435
Left = 240
TabIndex = 3
Top = 780
Width = 1695
End
Begin Label lbLastEvent
Caption = "Last Event Time"
Height = 255
Left = 240
TabIndex = 2
Top = 300
Width = 1695
End
Begin Label lbTime
BorderStyle = 1 'Fixed Single
Caption = "0"
Height = 255
Left = 2040
TabIndex = 0
Top = 300
Width = 1695
End
End
DefInt A-Z
Option Explicit
Declare Function GetIdleTime Lib "HOWLONG.DLL" () As Long
Declare Function ResetIdleOnUser% Lib "HOWLONG.DLL" (ByVal bFlag%)
Declare Function gettickcount Lib "user" () As Long
' Sample module, provided by A. Nicklas Malik
' (c) 1994, Malik Information Services, All Rights Reserved
' This module (TESTDLL.EXE) illustrates the use of the FREEWARE module,
' HOWLONG.DLL
' This VB program, and the DLL that it calls are property
' of Malik Information Services. A license is granted to any and
' all users who would like to include any portion of either
' the VB program or the DLL into their code, under the condition
' that any such user agrees that Nicklas Malik, Malik Information
' Services, and any of its employees, affiliates, distributors, or
' directors, are not liable for any damages, special, incidental,
' consequential or otherwise, arising out of the use of these programs.
' This program was created using Microsoft Visual Basic, Ver. 3.0 Pro Ed.
' The accompanying DLL was created using Borland C++ for Windows, Ver 3.1
Sub buQuit_Click ()
' note: you do not have to do anything special to
' unhook the DLL. It takes care of itself.
End
End Sub
Sub buUserFlag_Click ()
Static nouserflag As Integer
Dim rtn%
If nouserflag Then
rtn% = ResetIdleOnUser(True)
If rtn% <> 0 Then
MsgBox "Error! returned value is not zero!" ' debug testing
End If
nouserflag = False
buUserFlag.Caption = "Ignore &USER msgs"
Else
rtn% = ResetIdleOnUser(False)
If rtn% = 0 Then
MsgBox "Error! returned value is zero!" ' debug testing
End If
nouserflag = True
buUserFlag.Caption = "Accept &USER msgs"
End If
End Sub
Sub Form_Load ()
Dim myhwnd%
myhwnd% = testdll.hWnd
End Sub
Sub Timer1_Timer ()
Dim lastime As Long
Dim nowtime As Long
Static soundoff As Integer
Static soundtime As Long
lastime = GetIdleTime()
nowtime = gettickcount()
lbTime.Caption = Str$(lastime)
lbSecs.Caption = Str$(Int((nowtime - lastime) / 1000#))
If (lastime > soundtime) Then
If (nowtime - lastime) > 5000 Then
Beep
soundtime = nowtime
End If
End If
End Sub