By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,480 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,480 IT Pros & Developers. It's quick & easy.

Timingproblem in Windows

P: n/a
Hi!

I was using a windows standard timer in VB6.0 but had a
timing error over 9% on a win 98, no other applications
running.

So I decided to try the MultiMedia timer instead, and
everything works OK in the VB enviroment. But, when I make
an .ece file and run it (on the same machine as I develop
on) an error occures and the program terminates when the
first timer event occures! Error message is something
like '[some memory addresses] memory could not be "read".'

This is the very simple code I use:

========Module1======
Option Explicit

Public Declare Function timeSetEvent Lib "winmm.dll" _
(ByVal uDelay As Long, _
ByVal uResolution As Long, _
ByVal lpTimeProc As Long, _
ByVal dwUser As Long, _
ByVal fuEvent As Long) As Long

Public Declare Function timeKillEvent Lib "winmm.dll" _
(ByVal uTimerID As Long) As Long

Public Const TIME_PERIODIC = 1
Public Const TIME_CALLBACK_FUNCTION = &H0

Public Sub Main()
Form1.Show
End Sub

Public Function TimerProc(ByVal uID As Long, _
ByVal uMsg As Long, _
ByVal dwUser As Long, _
ByVal dw1 As Long, _
ByVal dw2 As Long) As Long
Form1.Print uID, uMsg, dwUser, dw1, dw2
End Function

========Form1========
Option Explicit
Dim hTimerID

Private Sub Form_Load()
hTimerID = timeSetEvent(1000, _
10, _
AddressOf Module1.TimerProc, _
1, _
TIME_PERIODIC Or TIME_CALLBACK_FUNCTION)
End Sub

Private Sub Form_Unload(Cancel As Integer)
If hTimerID <> 0 Then
timeKillEvent hTimerID
hTimerID = 0
End If
End Sub

best regards,
Andreas Lundgren
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Andreas Lundgren" <an*******@discussions.microsoft.com> schrieb
I was using a windows standard timer in VB6.0 but had a
timing error over 9% on a win 98, no other applications
running.


This is a VB.NET group. For older versions please turn to one of the
microsoft.public.vb.* groups.
--
Armin

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.