by Dane Jones (2 Submissions)
Category: Libraries
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (13 Votes)
This example shows a !completely! formless Timer alternative that only uses 2 API calls (SetTimer & KillTimer). This example also addresses some secuirity issues presented by the SetTimers CallBacks. I also defined all the exposed property descriptions for easy inclusion into your projects.
Inputs
Interval Property as a Long value representing Milliseconds.
Enabled Property used to Start or stop the Timer (Not to faroff from the VB Timer Control)
Assumes
The API is finiky, I crashed the VB IDE 3 times developing this tidbit until I got it stable. If you want to modify the code save often or the API will bite you.
Code Returns
Returns a 'Timer' Event
Side Effects
Some security issues that you will see in the code/comments
API DeclarationsPrivate Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIDEvent As Long) As Long
Download Anouther Formless Timer (14 KB)