How to show progress during long document open? 
Author Message
 How to show progress during long document open?

I have an MFC MDI Document/View application. Basically the Document is just
a representation of data from an SQL Server. At the moment I populate it
with data during the OnNewDocument call. However as it takes 10-20 seconds
to populate there is no application window showing during start-up of the
program during this process. I would like to be able to show some progress
for this?

Any ideas on the best way to do this?

Cheers
Paul Higgs



Mon, 23 Aug 2004 20:45:00 GMT  
 How to show progress during long document open?
I would throw up a splash screen with a nice graphic on it and then have a
progress indicator showing what % is loaded. If you have seen Adobe
PhotoShop, or Adobe AcroBat reader, use these as an example of a nice
loading screen


Quote:
> I have an MFC MDI Document/View application. Basically the Document is
just
> a representation of data from an SQL Server. At the moment I populate it
> with data during the OnNewDocument call. However as it takes 10-20 seconds
> to populate there is no application window showing during start-up of the
> program during this process. I would like to be able to show some progress
> for this?

> Any ideas on the best way to do this?

> Cheers
> Paul Higgs



Mon, 23 Aug 2004 22:00:55 GMT  
 How to show progress during long document open?
There are some issues to consider. If you are off computing, the GUI is not being
refreshed, so you won't see the progress bar move. The simplest way to handle something
like this is to do the work in a thread, and use PostMessage to send information back to
the main GUI thread to update the progress bar. Note that you will have to provide
suitable synchronization on the document to keep it from being used improperly during the
update.
                                joe



Quote:
>I have an MFC MDI Document/View application. Basically the Document is just
>a representation of data from an SQL Server. At the moment I populate it
>with data during the OnNewDocument call. However as it takes 10-20 seconds
>to populate there is no application window showing during start-up of the
>program during this process. I would like to be able to show some progress
>for this?

>Any ideas on the best way to do this?

>Cheers
>Paul Higgs

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Tue, 24 Aug 2004 05:02:11 GMT  
 How to show progress during long document open?
Thanks.

This worker thread will be adding information into a treeview on the CView
of the document, is it safe to do this from a worker thread , e.g. pass the
worker thread a pointer to my CDocument object?



Quote:
> There are some issues to consider. If you are off computing, the GUI is
not being
> refreshed, so you won't see the progress bar move. The simplest way to
handle something
> like this is to do the work in a thread, and use PostMessage to send
information back to
> the main GUI thread to update the progress bar. Note that you will have to
provide
> suitable synchronization on the document to keep it from being used

improperly during the
Quote:
> update.
> joe

> On Thu, 7 Mar 2002 12:45:00 -0000, "Paul Higgs"


Quote:

> >I have an MFC MDI Document/View application. Basically the Document is
just
> >a representation of data from an SQL Server. At the moment I populate it
> >with data during the OnNewDocument call. However as it takes 10-20
seconds
> >to populate there is no application window showing during start-up of the
> >program during this process. I would like to be able to show some
progress
> >for this?

> >Any ideas on the best way to do this?

> >Cheers
> >Paul Higgs

> Joseph M. Newcomer [MVP]

> Web: http://www3.pgh.net/~newcomer
> MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm



Wed, 25 Aug 2004 00:46:46 GMT  
 How to show progress during long document open?
Only if you guarantee that whatever is being done is properly synchronized, that is, if
the worker thread can write to the CDocument, whatever it is writing must be protected by
a CRITICAL_SECTION; or, if it is reading from the CDocument but the GUI thread can be
writing to the CDocument, likewise you must protect the data. Concurrent, unsynchronized,
access is permitted only in the cases where the values are ONLY being read but not
modified by the two threads (e.g., if the GUI thread sets up data before spawing the
worker thread, and does not change it until it knows the worker thread has terminated,
this is a form of synchronization, but does not require a CRITICAL_SECTION). And the
worker thread must not modify the tree control directly, only by sending requests to the
GUI thread to perform the modifications.
                                        joe



Quote:
>Thanks.

>This worker thread will be adding information into a treeview on the CView
>of the document, is it safe to do this from a worker thread , e.g. pass the
>worker thread a pointer to my CDocument object?



>> There are some issues to consider. If you are off computing, the GUI is
>not being
>> refreshed, so you won't see the progress bar move. The simplest way to
>handle something
>> like this is to do the work in a thread, and use PostMessage to send
>information back to
>> the main GUI thread to update the progress bar. Note that you will have to
>provide
>> suitable synchronization on the document to keep it from being used
>improperly during the
>> update.
>> joe

>> On Thu, 7 Mar 2002 12:45:00 -0000, "Paul Higgs"


>> >I have an MFC MDI Document/View application. Basically the Document is
>just
>> >a representation of data from an SQL Server. At the moment I populate it
>> >with data during the OnNewDocument call. However as it takes 10-20
>seconds
>> >to populate there is no application window showing during start-up of the
>> >program during this process. I would like to be able to show some
>progress
>> >for this?

>> >Any ideas on the best way to do this?

>> >Cheers
>> >Paul Higgs

>> Joseph M. Newcomer [MVP]

>> Web: http://www3.pgh.net/~newcomer
>> MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Thu, 26 Aug 2004 15:54:43 GMT  
 How to show progress during long document open?
Thanks for the help.

Paul


Quote:
> Only if you guarantee that whatever is being done is properly

synchronized, that is, if
Quote:
> the worker thread can write to the CDocument, whatever it is writing must
be protected by
> a CRITICAL_SECTION; or, if it is reading from the CDocument but the GUI
thread can be
> writing to the CDocument, likewise you must protect the data. Concurrent,
unsynchronized,
> access is permitted only in the cases where the values are ONLY being read
but not
> modified by the two threads (e.g., if the GUI thread sets up data before
spawing the
> worker thread, and does not change it until it knows the worker thread has
terminated,
> this is a form of synchronization, but does not require a

CRITICAL_SECTION). And the
Quote:
> worker thread must not modify the tree control directly, only by sending
requests to the
> GUI thread to perform the modifications.
> joe

> On Fri, 8 Mar 2002 16:46:46 -0000, "Paul Higgs"


Quote:

> >Thanks.

> >This worker thread will be adding information into a treeview on the
CView
> >of the document, is it safe to do this from a worker thread , e.g. pass
the
> >worker thread a pointer to my CDocument object?



> >> There are some issues to consider. If you are off computing, the GUI is
> >not being
> >> refreshed, so you won't see the progress bar move. The simplest way to
> >handle something
> >> like this is to do the work in a thread, and use PostMessage to send
> >information back to
> >> the main GUI thread to update the progress bar. Note that you will have
to
> >provide
> >> suitable synchronization on the document to keep it from being used
> >improperly during the
> >> update.
> >> joe

> >> On Thu, 7 Mar 2002 12:45:00 -0000, "Paul Higgs"


> >> >I have an MFC MDI Document/View application. Basically the Document is
> >just
> >> >a representation of data from an SQL Server. At the moment I populate
it
> >> >with data during the OnNewDocument call. However as it takes 10-20
> >seconds
> >> >to populate there is no application window showing during start-up of
the
> >> >program during this process. I would like to be able to show some
> >progress
> >> >for this?

> >> >Any ideas on the best way to do this?

> >> >Cheers
> >> >Paul Higgs

> >> Joseph M. Newcomer [MVP]

> >> Web: http://www3.pgh.net/~newcomer
> >> MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm

> Joseph M. Newcomer [MVP]

> Web: http://www3.pgh.net/~newcomer
> MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm



Fri, 03 Sep 2004 20:41:59 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Showing a modeless progress dialog while opening document with MFC

2. Progress bar not showing visual progress

3. Showing file loading/saving progress in progress bar?

4. Anybody know? Progress Bar during CListCtrl::DeleteAllItems()

5. Displaying progress screen during loading

6. Display progress during legthy operation.

7. Progress bar during OnOpenDocument()

8. char size (was long long long long long int)

9. Opening documents from within documents

10. showing progress in a command-line application

11. Progress control not showing

12. showing a copy in progress

 

 
Powered by phpBB® Forum Software