
'DoEvents' inside ActiveX DLL
When you say performance, what do you mean? Speed or client interface screen
updates (so the mouse is still usable).
The former, no, the latter yes.
If you go for Doevents (peekMessage) then be circumspect, don't splatter
them all over the place, in a big loop you really want to do something like
this:
For i& = 0 to nLoop-1
..... 'Do whatever thoust wilt
If i& Mod 1000 = 0 Then DoEvents
Next i&
or explicitly call a screen update if you can e.g. frmMain.refresh
or explicitly flash the cursor Screen.mousepointer =
vbDefault:screen.mouspointer = vbhourglass to give the user comfort
feedback. Use the Mod operator to do this every so many iterations or insert
the Doevents/Update statement within an outer loop if the inner loop is big,
you could then update an outer loop counter
As for within a dll, I've found on a local machine, there shouldn't be
problems unless you put Doevents in a stupid place! In some COM components
being called you absolutely have to use it in the calling loop (to yield
THEIR message loop).
Anybody else for better advice re: Doevents in dll's - I'm open to
correction here!
Quote:
> In objects inside my ActiveX DLL, there are some methods which send a
> query to the database, then process the results a little, and then
> return. Would it help peformance to place a 'DoEvents' after fetching
> results from the database and before processing the results? I have
> been recently trying to figure out threading with VB and COM, and have
> seen the injunction for avoiding 'DoEvents' in DLL's, but it is still
> not clear to me and I need a confirmation. TIA.