BOOL CProgressWnd::Create(CWnd* pParent, LPCTSTR pszTitle, BOOL bEnableCancel, /* = TRUE */ BOOL bSmooth /* = FALSE */)
{
    BOOL bSuccess;

    // Register window class
    CString csClassName = AfxRegisterWndClass(CS_OWNDC|CS_HREDRAW|CS_VREDRAW,
                                              ::LoadCursor(NULL, IDC_APPSTARTING),
                                              CBrush(::GetSysColor(COLOR_BTNFACE)));

    // Get the system window message font for use in the cancel button and text area
    NONCLIENTMETRICS ncm;
    ncm.cbSize = sizeof(NONCLIENTMETRICS);
    VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));
    m_font.CreateFontIndirect(&(ncm.lfMessageFont)); 

    // If no parent supplied then try and get a pointer to it anyway
    if (!pParent)
        pParent = AfxGetMainWnd();

    // Create popup window
    bSuccess = CreateEx(WS_EX_DLGMODALFRAME,               // Extended style
                        csClassName,                       // Classname
                        pszTitle,                          // Title
                        WS_POPUP|WS_BORDER|WS_CAPTION,     // style
                        0,0,                               // position - updated soon.
                        390,130,                           // Size - updated soon
                        pParent->GetSafeHwnd(),            // handle to parent
                        0,                                 // No menu
                        NULL);    
    if (!bSuccess) 
		return FALSE;

    // Now create the controls
    CRect TempRect(0,0,10,10);

    bSuccess = m_Text.Create(_T(""), WS_CHILD|WS_VISIBLE|SS_NOPREFIX|SS_LEFTNOWORDWRAP,
                             TempRect, this, IDC_TEXT);
    if (!bSuccess)
		return FALSE;

    DWORD dwProgressStyle = WS_CHILD|WS_VISIBLE;
#ifdef PBS_SMOOTH    
    if (bSmooth)
       dwProgressStyle |= PBS_SMOOTH;
#endif
    bSuccess = m_wndProgress.Create(dwProgressStyle, TempRect, this, IDC_PROGRESS);
    if (!bSuccess) 
		return FALSE;

    bSuccess = m_CancelButton.Create(m_strCancelLabel, 
                                     WS_CHILD|WS_VISIBLE|WS_TABSTOP| BS_PUSHBUTTON, 
                                     TempRect, this, IDC_CANCEL);
    if (!bSuccess)
       	return FALSE;

    m_CancelButton.SetFont(&m_font, TRUE);
    m_Text.SetFont(&m_font, TRUE);
    if (!bEnableCancel)
    {
        m_bEnableCancel = bEnableCancel;
        m_CancelButton.EnableWindow(FALSE);
    }

    // Resize the whole thing according to the number of text lines, desired window
    // width and current font.
    SetWindowSize(m_nNumTextLines, 390);

    // Center and show window
    if (m_bPersistantPosition)
        GetPreviousSettings();
    else
        CenterWindow();

    Show();

    return TRUE;
}
//=============================================================================
BOOL CXProgressWnd::Create(CWnd *pParent, 
						  LPCTSTR lpszTitle, 
// start modified code: added to allow dialog with only a message
						  BOOL bEnableCancel /* = TRUE */,
						  BOOL bEnableProgressBar /* = TRUE */,
// end modified code
						  LPCTSTR lpszAviId /*= NULL*/,
						  BOOL bSmooth /* = FALSE */)
//=============================================================================
{
	BOOL bSuccess = FALSE;

	m_pParent = pParent;
	ASSERT(m_pParent);
	if (!m_pParent)
		return FALSE;

	m_strTitle = lpszTitle;
	m_nPercentComplete = 0;

	struct OLD_NONCLIENTMETRICS
	{
		UINT    cbSize;
		int     iBorderWidth;
		int     iScrollWidth;
		int     iScrollHeight;
		int     iCaptionWidth;
		int     iCaptionHeight;
		LOGFONT lfCaptionFont;
		int     iSmCaptionWidth;
		int     iSmCaptionHeight;
		LOGFONT lfSmCaptionFont;
		int     iMenuWidth;
		int     iMenuHeight;
		LOGFONT lfMenuFont;
		LOGFONT lfStatusFont;
		LOGFONT lfMessageFont;
	};

	// Get the system window message font for use in 
	// the cancel button and messages

	// the size of the NONCLIENTMETRICS struct increased 
	// in Vista by an int (iPaddedBorderWidth)
	const UINT cbProperSize = IsVistaOrLater() ? 
		sizeof(OLD_NONCLIENTMETRICS)+sizeof(int) :
		sizeof(OLD_NONCLIENTMETRICS);

	NONCLIENTMETRICS ncm;
	ncm.cbSize = cbProperSize;

	VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, cbProperSize, &ncm, 0));
    VERIFY(m_font.CreateFontIndirect(&(ncm.lfMessageFont)));

	// register window class
	CString csClassName = AfxRegisterWndClass(CS_OWNDC|CS_HREDRAW|CS_VREDRAW,
											  ::LoadCursor(NULL, IDC_APPSTARTING),
											  CBrush(::GetSysColor(COLOR_BTNFACE)));

	// create popup window
	bSuccess = CreateEx(WS_EX_DLGMODALFRAME/*|WS_EX_TOPMOST*/,	// Extended style
						csClassName,						// Classname
						m_strTitle,							// Title
						WS_POPUP|WS_BORDER|WS_CAPTION|WS_SYSMENU,		// style
						0,0,								// position - updated soon.
						390,130,							// Size - updated soon
						m_pParent->GetSafeHwnd(),			// handle to parent
						0,									// No menu
						NULL);	
	if (!bSuccess) 
		return FALSE;

	SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);

	// now create the controls
	CRect TempRect(0,0,10,10);

// start modified code: added to allow dialog with only a message
	m_bEnableCancel = bEnableCancel;
	m_bEnableProgressBar = bEnableProgressBar;

	if (bEnableProgressBar)
	{
// end modified code
		DWORD dwProgressStyle = WS_CHILD|WS_VISIBLE;
#ifdef PBS_SMOOTH	
		if (bSmooth)
		   dwProgressStyle |= PBS_SMOOTH;
#endif
		bSuccess = m_wndProgress.Create(dwProgressStyle, TempRect, this, IDC_PROGRESS);
		if (!bSuccess) 
			return FALSE;
// start modified code: added to allow dialog with only a message
	}
// end modified code

	if (lpszAviId)
	{
		bSuccess = m_avi.Create(WS_CHILD|ACS_CENTER|ACS_TRANSPARENT|ACS_AUTOPLAY|WS_TABSTOP,
								TempRect, 
								this, 
								IDC_AVI);

		if (!bSuccess)
			return FALSE;

		UINT nID = (UINT) lpszAviId;

		if (HIWORD(nID))
			VERIFY(m_avi.Open(lpszAviId));		// open file
		else
			VERIFY(m_avi.Open(nID));			// open resource id
	}

// start modified code: added to allow dialog with only a message
	if (bEnableCancel)
	{
// end modified code
		bSuccess = m_CancelButton.Create(m_strCancelLabel, 
									 WS_CHILD|WS_VISIBLE|WS_TABSTOP| BS_PUSHBUTTON, 
									 TempRect, this, IDC_CANCEL);
		if (!bSuccess)
			return FALSE;

		m_CancelButton.SetFont(&m_font, TRUE);
// start modified code: added to allow dialog with only a message
	}
// end modified code

	// resize the whole thing according to the number of text lines, desired window
	// width and current font.
	SetWindowSize(m_nNumTextLines, 390);

	// center and show window
	if (m_bPersistentPosition)
		GetPreviousSettings();
	else
		CenterWindow();

	Show();

	return TRUE;
}