⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prgssdlg.cpp

📁 m16c flash startor 源码
💻 CPP
字号:
// PrgssDlg.cpp : Implementation file   
//
// This software can be offered for free and used as necessary to aid 
// in your program developments.
//
// RENESAS TECHNOLOGY CORPORATION, RENESAS SOLUTIONS CORPORATION,
// and related original software developers assume no responsibility 
// for any damage or infringement of any third-party's rights, originating 
// in the use of the following software.
// Please use this software under the agreement and acceptance of these conditions. 
//
// Copyright(C)1998(2003) RENESAS TECHNOLOGY CORPORATION AND RENESAS SOLUTIONS CORPORATION
// ALL RIGHTS RESERVED
//

#include "stdafx.h"
#include "M16CFlsh.h"
#include "PrgssDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CProgressDlg dialog

CProgressDlg::CProgressDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CProgressDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CProgressDlg)
	m_strMessage = _T("");
	//}}AFX_DATA_INIT
	
	m_pbCancel		= NULL;
	m_pParentWnd	= NULL;
}


void CProgressDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CProgressDlg)
	DDX_Control(pDX, IDC_PROGRESS, m_ctlProgress);
	DDX_Text(pDX, IDC_PROGRESS_MESSAGE, m_strMessage);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CProgressDlg, CDialog)
	//{{AFX_MSG_MAP(CProgressDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// It interfaces for object preparation.  
CProgressDlg*	CProgressDlg::Instance(BOOL* bpCancel, CWnd* pParentWnd)
{
	ASSERT(bpCancel != NULL);

	if ( bpCancel == NULL )
	{
		return	NULL;
	}

	// Make a CProgress object.  
	CProgressDlg*	pDlg = new CProgressDlg;

	// Set up the parents window of the dialo.  
	if ( pParentWnd == NULL )
	{
		// It makes the window that at present is effective, if the parents are not designated the parents.  
		pDlg->m_pParentWnd = CWnd::GetActiveWindow();
	}
	else
	{
		pDlg->m_pParentWnd = pParentWnd;
	}

	// Read the dialog resource.  
	if ( !pDlg->Create(IDD, pDlg->m_pParentWnd) )
	{
		delete pDlg;		// It failed to dialog generation.  
		pDlg = NULL;
		return	NULL;
	}

	// If I am able to make a dialog it makes the parents window use prohibition.  
	if ( pDlg->GetParentWnd() )
	{
		// I preserve the condition of before.  
		BOOL	bOldState = pDlg->GetParentWnd()->EnableWindow(FALSE);

		pDlg->EnableWindow(TRUE);

		if ( bOldState )
		{
			pDlg->m_bOldEnableState = FALSE;
		}
		else
		{
			pDlg->m_bOldEnableState = TRUE;
		}
	}

	// Preserve the pointer notify that did Cancel to the calling source for.  
	pDlg->m_pbCancel = bpCancel;

	pDlg->ShowWindow(SW_SHOW);

	return	pDlg;
}

/////////////////////////////////////////////////////////////////////////////
// CProgressDlg Interfacing.  
void CProgressDlg::InitialDialog(const CString& strMessage, const CString& strTitle,
							int	nLower, int nUpper, int nPos)
{
	// Message setting.  
	m_strMessage = strMessage;
	UpdateData(FALSE);

	// Dialog title setting.  
	SetWindowText(strTitle);

	// It is position setting at present progress bar range.  
	m_ctlProgress.SetRange(nLower, nUpper);
	m_ctlProgress.SetPos(nPos);

}

// The position is set up at the present moment of the progress bar.  
void CProgressDlg::SetProgressPos(int nPos)
{
	if ( ::IsWindow(GetSafeHwnd()) && ::IsWindow(m_ctlProgress.GetSafeHwnd()) )
	{
		m_ctlProgress.SetPos(nPos);
	}
}

// Dialog processing end.  
void CProgressDlg::Done()
{
	if ( ::IsWindow(GetSafeHwnd()) )
	{
		OnCancel();
	}
}

/////////////////////////////////////////////////////////////////////////////
// CProgressDlg Message handle  

void CProgressDlg::OnCancel() 
{
	// TODO: Please add a special post-processing to this position.  
	// Notify it was done Cancel, to calling that.
	notifyCancel();

	// The use permission condition of the parents window is returned to the source.  
	if ( GetParentWnd() )
	{
		GetParentWnd()->EnableWindow(m_bOldEnableState);
	}

	// Destroy the dialog.  
	if ( ::IsWindow(GetSafeHwnd()) )
	{
		DestroyWindow();
	}

//	Cdialog::OnCancel();	// Do not call CDialog::OnCancel(), because CProgressDlg is a moderess.  
}

void CProgressDlg::OnOK() 
{
	// TODO: Please add a special post-processing to this position.  
	
//	CDialog::OnOK();	// Do not call CDialog::OnOK(), because CProgressDlg is a moderess.  
}

void CProgressDlg::PostNcDestroy() 
{
	delete this;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -