waitdlg.cpp

来自「本程序是VC为平台开发的股票资讯系统」· C++ 代码 · 共 89 行

CPP
89
字号
// WaitDlg.cpp : implementation file
//

#include "stdafx.h"
#include "WaitDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CWaitDlg dialog

CWaitDlg::CWaitDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CWaitDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CWaitDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
   m_Text = _T("");
   m_bShowCancelButton = FALSE;
}


void CWaitDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CWaitDlg)
	DDX_Control(pDX, IDC_CONNECT, m_connect);
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CWaitDlg, CDialog)
	//{{AFX_MSG_MAP(CWaitDlg)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWaitDlg message handlers
void CWaitDlg::OnCancel() 
{
   //Override this so the user cannot cancel by hiting ESC
   return;
}

void CWaitDlg::OnOK() 
{
   //Ignore this unless the button is visible
   if (m_bShowCancelButton)
      {
	   m_Thread->m_Event->SetEvent();
	   CDialog::OnOK();
      }
}

BOOL CWaitDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
   if (m_Text.GetLength() > 0)
      GetDlgItem(IDC_BUSY_TEXT)->SetWindowText(m_Text);

   GetDlgItem(IDOK)->ShowWindow(m_bShowCancelButton ? SW_SHOW : SW_HIDE);

	m_connect.Open(IDR_CONNECT);
	m_connect.Play(0,-1,-1);
	SetTimer(1,500,NULL);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CWaitDlg::OnTimer(UINT nIDEvent) 
{
	CSingleLock lock(m_Thread->m_Event, FALSE);

   if (lock.Lock(0))
      {
      CDialog::OnOK();
      }

	//CDialog::OnTimer(nIDEvent);
}

⌨️ 快捷键说明

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