|
-
Jan 22nd, 2002, 10:55 AM
#1
Thread Starter
Addicted Member
SetTimer etc...
Hi,
I've just got this sort of thing from another thread, which works...
Code:
'In a module
Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
'Code here
End Sub
'In a form
Private Sub Form_Load()
SetTimer Me.hwnd, 1, 1000, AddressOf TimerProc
End Sub
Private Sub Form_Unload(Cancel As Integer)
KillTimer Me.hwnd, 1
End Sub
But what I want to know is what values would I need for hwnd and nIDEvent for SetTimer and Kill Timer if I was doing a similar thing with no forms, eg. in a dll?
Thank you
Last edited by sweevo; Jan 23rd, 2002 at 04:18 AM.
-
Jan 23rd, 2002, 04:32 AM
#2
New Member
' Put the following in class module
Dim TimerId As Long
Public Function Set_Timer()
TimerId = SetTimer(0, 0, 1000, AddressOf TimerProc)
End Function
Public Function Kill_Timer()
KillTimer 0, TimerId
End Function
' put the following code in std module.
' make dll and try......
Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Public Sub TimerProc()
MsgBox "Hai , i am from dll"
End Sub
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
|