473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Timing problem

Hi!

I was using a standard windows timer, but it gave an error over 9% on
a win 98 machine with no other programs running!

Bacause of this, I decided to implement windows MultiMedia timer, and
used code examples from msdn and this group. Everything works fine
when I run it from VB, but if I complie and run, I get an error (and
program termination) at the first timer event. (The .exe is ofcause
runned from the same machine as VB.)

I get the error message that '[some memory addresses] memory could not
be "read".'

My code is very, very short. Only the very nessecary rows are left and
still the error occures. (I'm quite new to work with dll's outside
VB.)

This is my code:
========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
Jul 17 '05 #1
0 1562

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jj | last post by:
I've got one database server that works fine when transferring large amounts of data, but a new one that has been setup seems to want to timeout or drop the connection after a period of time. I've...
2
by: Norm | last post by:
I have run into problems from time to time (and this is one of those times) using visual basic to access an external database and perform a basic select from statement. When the table is extremely...
2
by: Timo | last post by:
When content is transferred from a hidden IFRAME (which has fetched data from a database) to a DIV in the main document, how can a script determine that the DIV has been completely populated before...
9
by: Amir Ghezelbash | last post by:
Hey every body i had a question i am in process of writing an application, where this application needs to check the database on hourly bases to see if they are any information that are needed...
4
by: Brian Hanson | last post by:
Hi, I have a problem that is sporadic and am thinking it may come down to a timing issue. I have an asp.net (vb) app that used the system.io.file.copy method to copy a .pdf file from a network...
2
by: Steven D'Aprano | last post by:
The timeit module is ideal for measuring small code snippets; I want to measure large function objects. Because the timeit module takes the code snippet argument as a string, it is quite handy...
0
by: CCG | last post by:
A have a web app in vb.net & asp.net. The page has 3 frames. a left frame shows options and never changes. The top right frame has paramter screen or a report. The bottom horizontal frame has ...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
4
by: Nebulus | last post by:
We've got a website that's designed in classic ASP. While it's a good product, the original design was badly done, and I've inherited a monster. At some point last week, users began calling in...
2
by: julie.siebel | last post by:
Google apparently ate my original post to this (grr) so this'll be a bit more vague than the initial post, but...*sigh*. Javascript is not my forte, and I apologize for the acky-ness of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.