Hi novacain! Thanks for your help. Now it works.
Code:
BOOL CDVDVideoSolutionDlg::showPrgBarDlg( void )
{
clPrgBar = new CProgressBar();
if( clPrgBar->GetSafeHwnd())
clPrgBar->ShowWindow(SW_SHOW);
else
clPrgBar->Create( IDD_PROGRESS_BAR, this );
#if 1// center the dialog box
CRect rectMain;
GetClientRect(&rectMain);
int xMain = rectMain.Width();
int yMain = rectMain.Height();
// Get dimensions of the dialog
CRect rectView;
clPrgBar->GetWindowRect(&rectView);
int xView = rectView.Width();
int yView = rectView.Height();
// Calculate the (x,y) coordinate for Progress bar dialog.
int x = (xMain - xView) / 2;
int y = (yMain - yView) / 2;
// Move the dialog.
clPrgBar->MoveWindow(x, y, xView, yView, TRUE);
#endif
//make sure visible
clPrgBar->ShowWindow(SW_SHOW);
return TRUE;
}
Now, I have only 2 problems:
1. Center the Progress bar dialog; the code above was supposed to do it, somehow the dialog is not centered.
2. Get the sleep() function off the code
>>CProgressBar
not the best name as it might confilct with a named class.
Thank you for the warning, I will take it into consideration from now on.
Afrinux