jkw2068 is using a progress bar while copying large files. Unfortunately, the progress bar still does not work properly.

Up till now I have been using the

m_progress.SetPos(m_progress.GetPos() + 60);

respectively. The only problem occurs is when a large file is being
copied over, say 8-10MB. The bar just hangs until the file is copied
over and then adjusts to my calculation of completness.
How can I configure a progress bar to realtime?

Well, this is a simple function of your second dialog. And, as long as you are in that function, the message queue of that dialog will not be processed. In other words, your progress bar will not be updated. So, the best technique would be to update the progress bar by itself by using the UpdateWindow(); function. Thanks to Andreas Masur for providing the neccesary code:

Is it possible to open a file with shellexuecute without knowing the document type?
(top)

joleary wants to open a file with Shellexecute/ShellExecuteEx or CreateProcess. Unfortunately, he does not know the extension of that file. Is it still possible open it?

I have a filename provided by a user.
All I know for sure is that the file exists.
I want to open it with whatever application is associated with
this file and wait until that application is closed before
proceeding.
If ShellExecute/Ex (or whatever I end up using) cannot find an
association, I tell the user that I can't open the file and carry on.
If I am able to open the file, I want to wait until that application
(whatever it is) is closed before continuing with my processing.
So, I've learned how ShellExecute/Ex can execute the associated
application for me, but I do not understand how to wait for
whatever application that was actually executed to finish
because I don't know how to get a (guaranteed) viable process
handle from ShellExecute/Ex.
And I don't know how to make use of CreateProcess in this situation
to get that viable handle.
Is there another API I can use, to the Registry or somewhere, to
tell me, up front, what the file association is so I can use
CreateProcess?

You can use CreateProcess, but you will need to find the associated application for the specific extension on your own. CreateProcess() will not do it on its own. You can use the function FindExecuteable(), which will help you to do the lookup.

Well, it seems that he forgot to specify the namespace using namespace std;. But he already did that. The problem is that max is already defined as a macro. Enter the following lines before std::numeric_limits<double>::max().

Well, this is just a part of the question of the OP. The explaination is much longer and I am afraid that I can not display the whole question here. So in summary: Using push_back to add elements to the vector will create a temporary object and therefore effectively copy the data twice and the performance would be more costly than the C code.

In general, using any of the STL classes does not mean necessarily that the resulting code will perform slower than the old one. And, even with 'vector', it is most of the time the other way round. One common mistake is to actually compare debug versions instead of release ones.

Furthermore, if e.g. a 'vector' performs much slower in a release build, it is most-likely due to the fact that the implementation (how the 'vector' is being used, not the 'vector' implementation itself) is 'bad.' For example, in your case, you should already reserve enough memory (-> 'numElements') for the 'vector' up-front, so that no additional memory allocation is necessary while doing a 'push_back()'. Take a look at the whole thread to know more about that topic. Besides that, take a look at the following article.

About the Author

Sonu Kapoor

Sonu Kapoor is an ASP.NET MVP and MCAD. He is the owner of the popular .net website http://dotnetslackers.com. DotNetSlackers publishs the latest .net news and articles - it contains forums and blogs as well. His blog can be seen at: http://dotnetslackers.com/community/blogs/sonukapoor/

Comments

There are no comments yet. Be the first to comment!

You must have javascript enabled in order to post comments.

Leave a Comment

Your email address will not be published. All fields are required.

Name

Email

Title

Comment

Top White Papers and Webcasts

Live Event Date: March 19, 2015 @ 1:00 p.m. ET / 10:00 a.m. PT
The 2015 Enterprise Mobile Application Survey asked 250 mobility professionals what their biggest mobile challenges are, how many employees they are equipping with mobile apps, and their methods for driving value with mobility.
Join Dan Woods, Editor and CTO of CITO Research, and Alan Murray, SVP of Products at Apperian, as they break down the results of this survey and discuss how enterprises are using mobile application management and private …

On-demand Event
Event Date: February 12, 2015
The evolution of systems engineering with the SysML modeling language has resulted in improved requirements specification, better architectural definition, and better hand-off to downstream engineering. Agile methods have proven successful in the software domain, but how can these methods be applied to systems engineering? Check out this webcast and join Bruce Powel Douglass, author of Real-Time Agility, as he discusses how agile methods have had a tremendous …