Solved

Progress bar in dialog type window

Posted on 2006-11-12
3
242 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
ID: 17930358
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
ID: 17938485
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
ID: 17938759
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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