|
-
Sep 8th, 2001, 03:57 AM
#1
Thread Starter
Junior Member
Is SetTimer API usable for Win95
Documentation for SetTimer says it requires Win 95 or later but
documentation for its callback function TimerProc says that Win 98 or later is required.
I am confused.Plz Help
I know I wont get much sleep tonight but that does'nt stop me from going to bed.
-
Sep 8th, 2001, 02:57 PM
#2
Fanatic Member
I'm not sure why it says win98 in the info about the TimerProc thing in MSDN, but SetTimer works fine inside win95. I've used it on my laptop many times with no problems (except for those instances where I forget to turn them off, and then end the prog ). The VB TimerProc procedure looks identical to the one in MSDN.
VB Code:
'in a module
Public Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerProc 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 wMsg As Long, ByVal nIDEvent As Long, ByVal dwTicks As Long)
'your stuff here for the timer procedure
End Sub
'set a 1 second timer in Form1 with an ID of 1
SetTimer Form1.hWnd, 1, 1000, AddressOf TimerProc
'stop the timer
KillTimer Form1.hWnd, 1
'set a 1 second timer that is not associated with any window
Dim hTimer As Long
hTimer = SetTimer(0, 0, 1000, AddressOf TimerProc)
'stop the timer
KillTimer 0, hTimer
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
-
Sep 8th, 2001, 03:28 PM
#3
Monday Morning Lunatic
It could be that in order to use a callback timer you need 98. However, a timer that sends a message to your window works on 95.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 8th, 2001, 04:29 PM
#4
Fanatic Member
The callback still works on win95 though. If a callback doesn't work though, there's something else going on under the hood since it doesn't give any errors and otherwise works fine.
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
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
|