📄 computer.cpp
字号:
// Computer.cpp : implementation file
//
#include "stdafx.h"
#include "cvenus.h"
#include "Computer.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CComputer dialog
int g_iProgress;
bool bFinishThread;
CComputer::CComputer(CWnd* pParent /*=NULL*/)
: CDialog(CComputer::IDD, pParent)
{
//{{AFX_DATA_INIT(CComputer)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CComputer::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CComputer)
DDX_Control(pDX, IDC_PROGRESS1, m_ctrlBar);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CComputer, CDialog)
//{{AFX_MSG_MAP(CComputer)
ON_WM_TIMER()
//}}AFX_MSG_MAP
ON_MESSAGE(WM_THREADFINISHED, OnThreadFinished)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CComputer message handlers
BOOL CComputer::OnInitDialog()
{
CDialog::OnInitDialog();
if(!m_strTitle.IsEmpty())
SetWindowText(m_strTitle);
/*
CString strPath;
strPath = ((CCVenusApp*)AfxGetApp())->m_cGraFilePath;
CStdioFile stdfGraph;
CString strTemp = strPath + _T("\\test.GSW");
AfxMessageBox(strTemp);
bool bStatus = stdfGraph.Open(strTemp,CFile::modeCreate|CFile::modeWrite);
if(!bStatus)
{
TCHAR szMsg[100];
sprintf(szMsg, "Error opening file for reading. ");
AfxMessageBox(szMsg);
return 1;
}
stdfGraph.WriteString(_T("HELLO\n"));
stdfGraph.WriteString(_T("HHHHH\n"));
stdfGraph.WriteString(_T("OK\n"));
*/
// TODO: Add extra initialization here
m_nTimer = SetTimer(1, 100, NULL); // 1/10 second
g_iProgress = 0;
bFinishThread = false;
m_pThread = AfxBeginThread(ComputeThreadProc, GetSafeHwnd(),
THREAD_PRIORITY_NORMAL);
// ComputeThreadProc(GetSafeHwnd());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CComputer::OnCancel()
{
// TODO: Add extra cleanup here
bFinishThread = true;
KillTimer(m_nTimer);
CDialog::OnCancel();
}
void CComputer::OnOK()
{
// TODO: Add extra cleanup here
}
LRESULT CComputer::OnThreadFinished(WPARAM wParam, LPARAM lParam)
{
KillTimer(m_nTimer);
CDialog::OnOK();
return 0;
}
void CComputer::OnTimer(UINT nIDEvent)
{
m_ctrlBar.SetPos(g_iProgress);
CDialog::OnTimer(nIDEvent);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -