Hi
Can you help with the following timer code. I am using it to introduce a delay in my USB interface application which makes write 'calls' to a hardware USB digital/analogue interface via a DLL (supplied with the hardware. The code will introduce delays (i will need to experiment here) between successive interface 'Read', 'Clear' and 'write' operations.
Problem is that when I call the wait function, the application features can still be used, within and despite a wait call of many seconds (say 5000 mS) which is the numeric value I would pass to the function (ie no delay at all!) My understanding of 'doevents' is that it prevents any activity in the VB application, but allows the Win OS to process other application tasks in the background. The latter clearly happens as there is no 'lock up'.
The wait function code is given below. I pass values in milliseconds dwduration).
Many thanks in anticipation of you help.
i suspect the solution will be obvious when presented!
Hafod
Can you help with the following timer code. I am using it to introduce a delay in my USB interface application which makes write 'calls' to a hardware USB digital/analogue interface via a DLL (supplied with the hardware. The code will introduce delays (i will need to experiment here) between successive interface 'Read', 'Clear' and 'write' operations.
Problem is that when I call the wait function, the application features can still be used, within and despite a wait call of many seconds (say 5000 mS) which is the numeric value I would pass to the function (ie no delay at all!) My understanding of 'doevents' is that it prevents any activity in the VB application, but allows the Win OS to process other application tasks in the background. The latter clearly happens as there is no 'lock up'.
The wait function code is given below. I pass values in milliseconds dwduration).
Many thanks in anticipation of you help.
i suspect the solution will be obvious when presented!
Hafod
Code:
private sub Wait(dwDuration) as long
Dim dblstart As double, dblEnd As double
dblstart = timer
dblend=timer + (dwduration/1000)
Do
dblnow = timer
DoEvents
Loop Until dblNow< dblstart Or dblnow>dblEnd
End Sub