www.pudn.com > Raclient.rar > MadeCertDlg.cpp


// MadeCertDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Raclient.h" 
#include "MadeCertDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMadeCertDlg dialog 
 
 
CMadeCertDlg::CMadeCertDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CMadeCertDlg::IDD, pParent) 
{ 
	i=0; 
	//{{AFX_DATA_INIT(CMadeCertDlg) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CMadeCertDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CMadeCertDlg) 
	DDX_Control(pDX, IDC_PROGRESS_SAVE, m_ProgressSave); 
	DDX_Control(pDX, IDC_PROGRESS_PRINT, m_ProgressPrint); 
	DDX_Control(pDX, IDC_PROGRESS_MADE, m_Progress); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CMadeCertDlg, CDialog) 
	//{{AFX_MSG_MAP(CMadeCertDlg) 
	ON_WM_TIMER() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMadeCertDlg message handlers 
 
BOOL CMadeCertDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
 
	// TODO: Add extra initialization here 
	m_Progress.SetRange32(0,1000); 
	m_Progress.SetPos(0); 
	m_ProgressPrint.SetRange32(100,400); 
	m_ProgressPrint.SetPos(100); 
	m_ProgressSave.SetRange32(450,900); 
	m_ProgressSave.SetPos(450); 
	SetTimer(1,200,NULL); 
//	Print(); 
	GetDlgItem(IDOK)->ShowWindow(false); 
	 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CMadeCertDlg::OnTimer(UINT nIDEvent)  
{ 
	// TODO: Add your message handler code here and/or call default 
	if(nIDEvent!=1) return;//5-4-6 
	i++; 
	m_Progress.SetPos(i*10); 
	m_ProgressPrint.SetPos(i*10); 
	m_ProgressSave.SetPos(i*10); 
	if(i==40) 
	GetDlgItem(IDC_STATIC4)->ShowWindow(SW_SHOW); 
	if(i==90) 
	GetDlgItem(IDC_STATIC5)->ShowWindow(SW_SHOW); 
	if(i==100)  
	{ 
		GetDlgItem(IDC_STATIC6)->ShowWindow(SW_SHOW); 
		KillTimer(1); 
		GetDlgItem(IDOK)->ShowWindow(true); 
	} 
	CDialog::OnTimer(nIDEvent);	 
 
} 
 
 
void CMadeCertDlg::Print() 
{ 
	CDC dc; 
    CPrintDialog printDlg(FALSE); 
	if (printDlg.DoModal() == IDCANCEL)         // Get printer settings from user 
        return; 
	int copies=printDlg.GetCopies(); 
    dc.Attach(printDlg.GetPrinterDC());         // Attach a printer DC 
    dc.m_bPrinting = TRUE; 
 
    CString strTitle;                           // Get the application title 
    strTitle.LoadString(AFX_IDS_APP_TITLE); 
 
    DOCINFO di;                                 // Initialise print document details 
    ::ZeroMemory (&di, sizeof (DOCINFO)); 
    di.cbSize = sizeof (DOCINFO); 
    di.lpszDocName = strTitle; 
         
    CPrintInfo Info; 
    Info.m_rectDraw.SetRect(0,0,  
                            dc.GetDeviceCaps(HORZRES),  
                            dc.GetDeviceCaps(VERTRES)); 
	dc.StartDoc(&di); 
	dc.StartPage(); 
	/////////////////////// 
	////////////////////// 
	dc.EndPage(); 
	dc.EndDoc();  
     
    dc.Detach();  	 
 
}