// LoadingLogDlg.cpp : implementation file // #include "stdafx.h" #include "loadinglogdlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CLoadingLogDlg dialog CLoadingLogDlg::CLoadingLogDlg(CWnd* pParent /*=NULL*/) : CDialog(CLoadingLogDlg::IDD, pParent) { count = 0; maxCount = -1; stopProcess = FALSE; loading = FALSE; //{{AFX_DATA_INIT(CLoadingLogDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CLoadingLogDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CLoadingLogDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CLoadingLogDlg, CDialog) //{{AFX_MSG_MAP(CLoadingLogDlg) ON_WM_TIMER() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CLoadingLogDlg message handlers void CLoadingLogDlg::OnCancel() { //afxDump << "CLoadingLogDlg::OnCancel" << "\n"; // TODO: Add extra cleanup here stopProcess = TRUE; //CDialog::OnCancel(); } void CLoadingLogDlg::CancelRecived() { //afxDump << "CLoadingLogDlg::CancelRecived" << "\n"; CDialog::OnCancel(); } void CLoadingLogDlg::OnTimer(UINT nIDEvent) { if (!loading) { loading = TRUE; document->LoadResource(*ar, this); KillTimer(1); loading = FALSE; CancelRecived(); return; } CProgressCtrl* pBar = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS); pBar->SetPos(count * 100 / maxCount); CDialog::OnTimer(nIDEvent); } void CLoadingLogDlg::AddString(CString message) { CListBox* pList = (CListBox*)GetDlgItem(IDC_EDIT_BOX); pList->AddString(message); } void CLoadingLogDlg::SetTopIndex(int index) { CListBox* pList = (CListBox*)GetDlgItem(IDC_EDIT_BOX); pList->SetTopIndex(index); } int CLoadingLogDlg::DoModal(CArchive& t_ar, CLabRatDoc *t_document) { //TRACE("CLoadingLogDlg::DoModal\n"); ar = &t_ar; document = t_document; return CDialog::DoModal(); } BOOL CLoadingLogDlg::OnInitDialog() { CDialog::OnInitDialog(); //TRACE("CLoadingLogDlg::OnInitDialog\n"); loading_timer = SetTimer(1, 100, NULL); CProgressCtrl* pBar = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS); pBar->SetRange(0, 100); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }