473,394 Members | 1,752 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,394 software developers and data experts.

Timingproblem in Windows

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
1 945
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
3
by: Christian McArdle | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.os.ms-windows.programmer.64bit This is a formal Request For Discussion (RFD) to create comp.os.ms-windows.programmer.64bit as an unmoderated...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
4
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
2
by: sambo251 | last post by:
After running a few updates I get this very annoying "Windows Installer" error #1706 that will ne go away! It keeps saying that it cannot find the file "instantsharedevices.msi", that it is on...
1
by: mfunkmann | last post by:
Hi, I recently got an error and I don't know how to fix it: Error 1 'System.Data.DataColumn' does not contain a definition for 'Windows' C:\c#\CsharpPRO\Form1.Designer.cs 304 77 CsharpPRO I...
0
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: List of autostart locations Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list all the autostart locations for windows? Ans: Here is...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.