|
| Hi Everyone,
I used the code below I found that the progress bar movement is not smooth, there is some struck during the movement of the progress bar initially i kept the sleep time as 50 and now reduced to sleep(1). Even I am getting the struck in the movement of the progress bar.
m_CtlTempoBar is the member variable for the Progress bar.
Looking forward to hear from you ASAP.
Thanks & Regards,
Gan
/////////////////---------------------------------////////////////////////////////
In onInitialDialog()
{
..................
..................
m_CtlTempoBar.SetRange(0,250);
try{
HANDLE hT;
tMovementDisplay = AfxBeginThread(HandleMovementBar, this,THREAD_PRIORITY_TIME_CRITICAL,0,0,0 );
hT = tMovementDisplay;
CeSetThreadPriority(GetCurrentThread(),0);
CeSetThreadQuantum(hT,0);
}
catch(...) {
}
............................
}
UINT CTestTempoBarDlg::HandleMovementBar(LPVOID param)
{
TRY{
// constants; counters/initialisers used for tempo bar display
int iBase = 0;
int iFlag = 1;
int iCount = 1;
unsigned int i=1;
// The current series display identifier.
CTestTempoBarDlg* dpCurrentSeries = (CTestTempoBarDlg*)param;
while (true) {
//Setting the tempo bar current status display
dpCurrentSeries->m_CtlTempoBar.SetPos(iBase + ((iCount*iFlag)*10));
//calculating the tempo bar next status display
if (iCount == 25)
{
iFlag = iFlag * (-1);
if (iFlag>=0)
{
iBase = 0;
}else
{
iBase = 250;
}
iCount = 0;
}
++iCount;
//register long i;
volatile register long k = 0;
register long j=0;
register long Maxv=0;
long tick3=GetTickCount();
long tick1=0;
long tick5=0;
long maxtick=0;
long tick2=0;
for (int ii=0;ii<30;ii++ )
{
tick1=GetTickCount();
for(i=0;i<500;i++ )
{
k++;
}
tick2=GetTickCount();
if ((tick2-tick1)>Maxv)
{
Maxv=tick2-tick1;
}
Sleep(1);
tick5=GetTickCount();
if( (tick5-tick2)>maxtick)
maxtick=tick5-tick2;
}
}
}
CATCH_ALL(e) {
}
END_CATCH_ALL
return 0;
}
| |
|
Seconds to generate: 0.132 - Cached queries : 58 - Executed queries : 9
| | |
|