[AccessD] suspend execution of VB code

Henry Simpson hsimpson88 at hotmail.com
Tue Feb 18 22:03:00 CST 2003


Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Short and sweet and fine for short interval delays and also doesn't hog the 
processor.  Calling it with a large number of milliseconds will have the 
application show up as 'not responding' in the Task Manager and will suspend 
mouse interaction with the application and you don't get screen refresh or 
repaint during the wait.  Keep the wait intervals short and no one is the 
wiser.  Try Q231298 at Microsoft.com for more detail on the differences.  
For one thing, the waitabletimer is not available in Win 95 and the use of a 
progress bar will keep users amused and unconcerned about the application 
being locked if you use Sleep with a progress bar.  I only use the waitable 
version for longer waits like sending several Word print jobs to the queue 
before killing Word.

Hen



>From: Drew Wutka <DWUTKA at marlow.com>
>Reply-To: accessd at databaseadvisors.com
>To: "'accessd at databaseadvisors.com'" <accessd at databaseadvisors.com>
>Subject: RE: [AccessD] suspend execution of VB code
>Date: Tue, 18 Feb 2003 20:23:21 -0600
>
>Use the following code.  Watch for word wrap on the API Calls.  This
>function uses an API to delay your code by x number of
>milliseconds...without cycling your processor over and over.
>
>
>
>
>Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle
>As Long, ByVal dwMilliseconds As Long) As Long
>Private Declare Function CreateWaitableTimer Lib "kernel32" Alias
>"CreateWaitableTimerA" (ByRef lpTimerAttributes As Long, ByVal bManualReset
>As Long, ByVal lpTimerName As String) As Long
>Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long)
>As Long
>
>Private Function DelayRoutine(intMilliseconds As Long)
>Dim dwReturn As Long
>Dim intTimer As Long
>intTimer = CreateWaitableTimer(0, True, "MicrosoftAccessDelay" & Chr(0))
>dwReturn = WaitForSingleObject(intTimer, intMilliseconds)
>CloseHandle intTimer
>End Function
>
>
>
>Drew
>-----Original Message-----
>From: Scott Gage [mailto:scotttgage at yahoo.com]
>Sent: Tuesday, February 18, 2003 7:47 PM
>To: accessd at databaseadvisors.com
>Subject: [AccessD] suspend execution of VB code
>
>
>HELP!
>
>I need to slow down the code I'm running. It is
>running a ton of append queries to groom some data. I
>thought I'd make a progress dialog box while I'm at
>it. I will need the code to suspend execution for a
>few seconds and then start back up without any end
>user action.
>
>Can anyone point me in the right direction? I read
>Break point but the end user has to do something to
>start the code back up.
>
>Scott
>
>=====
>--------------------
>Scott T. Gage
>Scott.gage at promedica.org
>419.291-7177
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! Shopping - Send Flowers for Valentine's Day
>http://shopping.yahoo.com
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com


_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail




More information about the AccessD mailing list