Re: Who is responsible for refreshing the UI?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If your code must be synchronous, you can insert a message
pump each time before you raise your status update event.
This is not a perfect solution of course... Also, beware reentrancy.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

"Bruce E. Stemplewski" <Bruce.Stemplewski@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
in message news:kO8ag.810$nq5.524@xxxxxxxxxxx
My OCX has a method that has a lengthy method so I call a connection point
(event) to keep the calling application updated on the progress of the
method.

Now I am no VB programmer so I am not sure if I wrote my sample code
correctly but one thing I have noticed is that UI does not seem to get
fully updated. The foreground dialogs seem to update OK but the dialog
box in the background does not seem to be updated. I would also like to
allow the user to have a cancel button but when I try this in my sample
code, the button does not function till the method is complete.

I would like to make things as easy as possible for the end user
programmer. I am calling Yield() in my ATL OCX but that does not seem to
make a difference on the VB side. Should I spawn a thread to execute my
lengthy method? The problem I see with this is that the method would exit
while the method is not truly complete. I suppose I could have a Complete
event (which I already have) but that would mean the end user programmer
would have to remember to us this event to update their UI after the
method is complete. Is there an easier and better may I should be doing
this?

My guess is I really need a thread in the VB code to handle the dialog box
but I understand that threads do not work in VB6.



--
Bruce E. Stemplewski
GarXface OCX and C++ Class Library for the Garmin GPS
www.stempsoft.com


.



Relevant Pages

  • Re: Editing recorded TV files
    ... I'm not a programmer so have no idea how to go about using this. ... > The DVR-MS Sample Code also includes a DVR-MS editor. ... >> Just a basic editing program to remove those pesky commercials. ... >>> editing software needs to be able to be able to convert this sort of format ...
    (microsoft.public.windows.mediacenter)
  • Re: File IO -- Reading Config Files Easily
    ... The programmer was using something in the Java API to easily read this in ... It's the Properties class - more information and sample code can be found in ...
    (comp.lang.java.help)
  • Re: How to use iconv() from C?
    ... Thanks a lot for your sample code. ... The following code is longer and might not look that elegant but it ... tells the programmer what the values are used for. ... See if using regular iconv_openwill ...
    (comp.sys.ibm.as400.misc)
  • Re: Code curosity
    ... >> much higher level instructions that the programmer wrote ... The problem with sample code from a vendor is that it's often pedantic ... to the point of mania about a single topic that it's trying to ... "Are You Berry Berry Happy?" ...
    (comp.sys.mac.system)
  • Re: OT: down with memory protection!
    ... >> and the compiler and programmer could be required to prove that the code ... >> would not loop forever without calling yield. ... Let the programmer try to prove it. ...
    (Debian-User)