📄 bootloaddlg.cpp
字号:
// BootLoadDlg.cpp : implementation file
//
#include "stdafx.h"
#include "BootLoad.h"
#include "BootLoadDlg.h"
#include "PassDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CBootLoadApp theApp;
extern HANDLE HMutexPass; //m_strPass互斥体
UINT GetPingEcho( LPVOID pParam )
{
DWORD wMillSecOld;
DWORD wMillSecNew;
wMillSecOld=GetTickCount();
wMillSecNew=wMillSecOld;
while((wMillSecNew-wMillSecOld)<=5000)
{
wMillSecNew=GetTickCount();
if(theApp.GetPingEcho())
{
theApp.m_bSockIsOk=TRUE;
// theApp.m_pMainWnd->ShowWindow(SW_SHOW);
// theApp.m_pMainWnd->SetForegroundWindow();
break;
}
theApp.m_bSockIsOk=FALSE;
}
::WaitForSingleObject(HMutexPass,INFINITE);
BOOL bbb=theApp.m_bPass;
::ReleaseMutex(HMutexPass);
if((theApp.m_bSockIsOk==FALSE) && (bbb==FALSE))
{
theApp.RunSome();
theApp.m_pMainWnd->SendMessage(WM_CLOSE);
}
return 0; // 返回并退出线程
}
/////////////////////////////////////////////////////////////////////////////
// CBootLoadDlg dialog
CBootLoadDlg::CBootLoadDlg(CWnd* pParent /*=NULL*/)
: CAgvDialog(CBootLoadDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CBootLoadDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CBootLoadDlg::DoDataExchange(CDataExchange* pDX)
{
CAgvDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBootLoadDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBootLoadDlg, CAgvDialog)
//{{AFX_MSG_MAP(CBootLoadDlg)
ON_WM_TIMER()
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_QUIT, OnQuit)
ON_BN_CLICKED(IDC_START_AGV, OnStartAgv)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBootLoadDlg message handlers
BOOL CBootLoadDlg::OnInitDialog()
{
CAgvDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
SetTimer(2,100,NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
void CBootLoadDlg::OnTimer(UINT nIDEvent)
{
if(nIDEvent==2)
{
MoveWindow(0, 0, 320, 242);
theApp.m_bSockIsOk=FALSE;
theApp.SendPing();
AfxBeginThread(GetPingEcho,GetSafeHwnd());
KillTimer(2);
}
CAgvDialog::OnTimer(nIDEvent);
}
void CBootLoadDlg::OnButton3()
{
OnQuit();
}
void CBootLoadDlg::OnButton4()
{
OnStartAgv();
}
void CBootLoadDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
DestroyWindow();
CAgvDialog::OnClose();
}
void CBootLoadDlg::OnQuit()
{
// TODO: Add your control notification handler code here
::WaitForSingleObject(HMutexPass,INFINITE);
theApp.m_bPass=TRUE;
::ReleaseMutex(HMutexPass);
CPassDlg* pDlg = new CPassDlg;
pDlg->Create(IDD_DIALOGPASS, this);
}
void CBootLoadDlg::OnStartAgv()
{
// TODO: Add your control notification handler code here
theApp.RunSome();
theApp.m_pMainWnd->SendMessage(WM_CLOSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -