Monday 7 July 2014

Tagged Under:

Program To Create a Loading Bar In C++

Share

This topic explains how to use a progress bar to indicate the progress of a lengthy file-parsing operation.


Create a Progress Bar Control


Program to create a loading bar
Progress Bar


The following example code creates a progress bar and positions it along the bottom of the parent window's client area. The height of the progress bar is based on the height of the arrow bitmap used in a scroll bar. The range is based on the size of the file divided by 2,048, which is the size of each "chunk" of data that is read from the file. The example also sets an increment and advances the current position of the progress bar by the increment after parsing each chunk.
Source Code

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>

void main()
{
 int x=170,i,gdriver=DETECT,gmode;
 initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
 settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
 outtextxy(170,180,"LOADING,PLEASE WAIT");

  for(i=0;i<300;++i)
 {
  delay(30);
  line(x,200,x,220);
  x++;
 }
 getch();
 closegraph();
}



This article is contributed Tarun Kumar. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.



0 comments:

Post a Comment

Contact Us

Want to ask anything? Be our guest, give us a message.

Name Email * Message *