📄 msg.cpp
字号:
// Msg.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Msg.h"
#include "MsgDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMsgApp
BEGIN_MESSAGE_MAP(CMsgApp, CWinApp)
//{{AFX_MSG_MAP(CMsgApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMsgApp construction
CMsgApp::CMsgApp()
: CWinApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMsgApp object
CMsgApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CMsgApp initialization
BOOL CMsgApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
CMsgDlg dlg;
m_pMainWnd = &dlg;
SetDialogBkColor(RGB(255,255,255),RGB(0,0,0));
//打开串口,将COM1改为COM3,2006/1/15,2006/4/12用WINCE SERIAL工程,COM3可以运行
dlg.hPort = CreateFile (TEXT("COM3:"), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
//如果打开端口出错, 返回FALSE
if (dlg.hPort == INVALID_HANDLE_VALUE )
{
//不能打开端口
AfxMessageBox(TEXT("Cant Open The Port!\nPlease Check the Com Whether Other Device is Using!\nAnd Try Again Later!"));
//The PostQuitMessage function indicates to the system that a thread
//has made a request to terminate (quit). It is typically used in response
//to a WM_DESTROY message.
PostQuitMessage(1);
// SendMessage(WM_CLOSE);
}
else
{
//MessageBox(NULL,TEXT("Msg.cpp"),TEXT("CAPTION"),MB_OK);
dlg.nResponse= dlg.DoModal();
}
/* if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}*/
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -