Solved

Progress bar in dialog type window

Posted on 2006-11-12
3
219 Views
Last Modified: 2010-04-24
Hi all,
   I would like to have a progress bar run fromo left to right for a application. I cannot figure out how to link the activex progress bar with the method in which I want to show the progress bar. I would appreciate if someone could help me and tell me the code to link the microsoft activx progress control. Details: -
There is an application where the user selects certain files and wants to view them. there is a button which allows the user to view all files at once openned (appended), which takes time. I would like to have a progress bar which could be incorporated which becomes visible only when the user hits that button.

I would appreciate your help.
Thanks,
Ritesh
0
Comment
Question by:riteshromi
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 125 total points
Comment Utility
A progress bar (AFAIK) needs to have the 'progress' coming from the appllication.  It won't automatically fill from left to right.

Can you tell how far along the preparation/viewing of the files is in your code?




pseudo code

pBar->SetRange(0, 100);
while(busy)
{
  DOSomething();
  pBar->SetPos(iCurrentPositionInLoop);
}
0
 

Author Comment

by:riteshromi
Comment Utility
Thanks for the comment ....I got hoe to implement the progress bar when busy. It works good ...THE ONLY CONCERN here is to add a text to the bar a statis text which will be visible only when the progress bar is stepping up. I tried the following

CStatic *Label = new CStatic;
      Label->Create("Processing Please Wait", WS_VISIBLE, CRect(50, 530, 220, 550), this, 0x188);
//additional code here
      Label->DestroyWindow();

this is in the method (onclick of a button)
this does not show the text .....only shows the text when the control comes out of the method.
I would appreciate if you could help me.

Thanks,
Romi
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
void DoEvents()
{  
      MSG msg;  
      while ( ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE ) )
      {  
            ::TranslateMessage(&msg);
            ::DispatchMessage(&msg);
      }
}

usage
CStatic *Label = new CStatic;
     Label->Create("Processing Please Wait", WS_VISIBLE, CRect(50, 530, 220, 550), this, 0x188);

DoEvents();  <<------ try adding this


//additional code here
     Label->DestroyWindow();
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now