Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: program is unresponsive during API calls--normal?


Message #1 by "Pardee, Roy E" <roy.e.pardee@l...> on Mon, 20 Aug 2001 14:37:57 -0700
That sounds like a good strategy--offload the waiting to a separate process
that has no UI to get bogged down.  Many thanks for your thoughts on this.

Cheers,

-Roy

-----Original Message-----
From: Chris Tacke [mailto:ctacke@r...]
Sent: Tuesday, August 21, 2001 8:23 AM
To: professional vb
Subject: [pro_vb] RE: program is unresponsive during API calls--normal ?


If the reports take a significant amount of time, I would do the following:

Create a separate Active-X EXE that generates the reports.
Have the EXE take all report parameters as inputs.
have the new EXE poll to find the output file (assuming that the output file
will appear when the report is done).
When the file appears, have the EXE fire an event that the caller listens
for.
THe caller then can notify the user the report is done while allowing the
user to do other things.



> -----Original Message-----
> From: Pardee, Roy E [mailto:roy.e.pardee@l...]
> Sent: Tuesday, August 21, 2001 11:11 AM
> To: professional vb
> Subject: [pro_vb] RE: program is unresponsive during API calls--normal ?
>
>
> Yes, that would be cool--that was my first hope.  Sadly, I'm kicking off
> Oracle Reports, which (to the best of my knowledge) does not
> expose any sort
> of COM-compatible interface, and also returns
> asynchronously--there's no way
> to have it pause the processing in my program until it's finished
> & written
> either an output file or an error log file.  (If anybody knows
> differently,
> I would love to hear about it!)
>
> (If we were using Oracle's Reports Server I could use an ocx that Oracle
> ships that is supposed to do synchronous processing if directed, but it
> seems unrealistic to expect my users to put up an ORS just for my little
> e-mail responder application...)
>
> Cheers,
>
> -Roy
>
> -----Original Message-----
> From: Chris Tacke [mailto:ctacke@r...]
> Sent: Tuesday, August 21, 2001 7:49 AM
> To: professional vb
> Subject: [pro_vb] RE: program is unresponsive during API calls--normal ?
>
>
> The question is, why do you want it to wait?  Is it an aesthetic
> thing?  Are
> you waiting for something else to complete?
>
> If you can react to an event or receive a callback, it would eliminate the
> Sleep or DoEvents loop.
>
>
>
> > -----Original Message-----
> > From: Pardee, Roy E [mailto:roy.e.pardee@l...]
> > Sent: Tuesday, August 21, 2001 10:39 AM
> > To: professional vb
> > Subject: [pro_vb] RE: program is unresponsive during API calls--normal ?
> >
> >
> > Ah, very cool--that makes perfect sense--thanks!
> >
> > If I may impose further...  My application automates Outlook to process
> > e-mailed requests for reports.  I'm using the NewMail event of
> > Outlook.Application to trigger incoming message processing.  If
> I were to
> > use DoEvents in a loop as you are suggesting, can you say
> whether I would
> > risk having an additional NewMail event fire during the
> processing of the
> > previous NewMail event?  (If you can tell what the hell I'm trying to
> > ask...)
> >
> > Thanks again!
> >
> > -Roy
> >
> > -----Original Message-----
> > From: Marco Straforini [mailto:marco.straforini@c...]
> > Sent: Monday, August 20, 2001 5:57 PM
> > To: professional vb
> > Subject: [pro_vb] RE: program is unresponsive during API calls--normal?
> >
> >
> > Roy,
> >
> > the sleep() API just blocks your application. It means that if you
> > sleep for let's say 20 seconds, your app will not process any events
> > for 20 seconds. Pretty bad uh? This is why sleep should not be
> > used in any user interface apps.
> >
> > The easiest solution is to break the sleep into a shorter period
> > (let's say one second) within a loop together with a DoEvents, like
> >
> > for i = 0 to 19
> >     sleep 1
> >     DoEvents
> > next
> >
> > The problem is that DoEvents will process every events, including maybe
> > something you do not want (like events from remote servers). More
> > advanced techniques peek into the message queue and process only
> > mouse events, leaving out everything else. I do not remember where
> > I read this though.
> >
> > m.
> >
> >
> >
> > -----Original Message-----
> > From: Pardee, Roy E [mailto:roy.e.pardee@l...]
> > Sent: Monday, August 20, 2001 2:38 PM
> > To: professional vb
> > Subject: [pro_vb] program is unresponsive during API calls--normal?
> >
> >
> > Greetings all,
> >
> > I've got a very simple app that shells out to Oracle reports &
> > waits for an
> > output file to show up.  I figured I'd use the Sleep API call (Private
> > Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As
> Long)) to get my
> > app to lay dormant for a bit while Oracle did its thing.  This
> > seems to work
> > okay, but it looks to me like VB is altogether unresponsive during this
> > time--if I alt-tab from VB IDE to another program & then try to
> come back,
> > the screen doesn't refresh.
> >
> > I've not done a ton of API, but I seem to remember having the
> same problem
> > w/some WinInet functions.  Is this just the way API calls work, or is it
> > just Sleep?  Is there something I could be doing differently (a
> different
> > API function maybe?) that would give smoother performance?
> Maybe DoEvents
> > in a For loop?
> >
> > Thanks!
> >
> > -Roy
> >
> > Roy Pardee
> > Programmer/Analyst

  Return to Index