Introduction
MFC provides the CProgressCtrl
class that helps to make the Windows progress bar control. CProgressCtrl
is derived directly from Cwnd
class and inherits the function of Cwnd
class. It can be created as a child control of any window and also you can use from the dialog resource template.
I need the control that shows graphical effect in changing the sound level, so I made this application which is presented to you. I used it in a voice graph application using different voices. Here I used timer to show the graphical effect of progress bar.
Thing Required
- Microsoft Visual C++ 6.0.
- Microsoft Windows 9x/2000/XP.
Code
void CGraphProgressView::OnButton1()
{
BOOL fRun = FALSE;
if(fRun)
{
m_btnRun.SetWindowText("Run");
KillTimer(1);
}
else
{
m_btnRun.SetWindowText("Stop");
SetTimer(1,85, 0);
}
fRun = !fRun;
}
void CGraphProgressView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
DDXControl(pDX, IDC_BUTTON1, btnRun);
DDX_Control(pDX, IDC_PROGRESS1, m_progress1);
DDX_Control(pDX, IDC_PROGRESS2, m_progress2);
DDX_Control(pDX, IDC_PROGRESS3, m_progress3);
DDX_Control(pDX, IDC_PROGRESS4, m_progress4);
DDX_Control(pDX, IDC_PROGRESS5, m_progress5);
DDX_Control(pDX, IDC_PROGRESS6, m_progress6);
DDX_Control(pDX, IDC_PROGRESS7, m_progress7);
DDX_Control(pDX, IDC_PROGRESS8, m_progress8);
DDX_Control(pDX, IDC_PROGRESS9, m_progress9);
DDX_Control(pDX, IDC_PROGRESS10, m_progress10);
DDX_Control(pDX, IDC_PROGRESS11, m_progress11);
DDX_Control(pDX, IDC_PROGRESS12, m_progress12);
DDX_Control(pDX, IDC_PROGRESS13, m_progress13);
DDX_Control(pDX, IDC_PROGRESS14, m_progress14);
DDX_Control(pDX, IDC_PROGRESS15, m_progress15);
}
Class Methods
I used the two methods of the CProgressCtrl
class.
SetStep() | It shows the step increment for a progress bar control. |
SetIt() |
It advances the current position for a progress bar control by the step increment and redraws the bar to show the new position. |
Using the MFC AppWizard (exe) application: choose the base class CFormView
, to make this application. Try to make it and enjoy.
I did Msc Computer Scicences specialization in software engineering from University of Management and Technology Lahore,and having the experience of IT for more than 5 years.
I have worked in different programming languages, such as: C, C++, Visual C++,Java, Visual Basic and C#, also in PHP, HTML, ASP, ASP.NET and also CCNA & RedHat Linux. Love Mathematics. I have always been fascinated by .NET, so now I am programming in .NET.
You can email me: only_boby@hotmail.com
Visit my web site: http://www28.brinkster.com/abdulhye