Solved

Progress bar in dialog type window

Posted on 2006-11-12
3
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DLL Windows equivalent in MAC OS 8 144
multiple DLLs with the same namespace 5 107
Visual Studio community 2015 2 83
Paint/Redraw window while dragging 16 86
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

763 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