📄 lane_new.cpp
字号:
// lane_new.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "lane_new.h"
#include "lane_newDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLane_newApp
BEGIN_MESSAGE_MAP(CLane_newApp, CWinApp)
//{{AFX_MSG_MAP(CLane_newApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLane_newApp construction
CLane_newApp::CLane_newApp():muxKill1(),muxKill2(),muxKill3(),muxKill4(),
muxCxpFree(),muxPicture(),muxPrint(),muxTimerOut(),muxTime()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
nScreenX=GetSystemMetrics(SM_CXSCREEN); //获取屏幕分辨率
nScreenY=GetSystemMetrics(SM_CYSCREEN);
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CLane_newApp object
CLane_newApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CLane_newApp initialization
BOOL CLane_newApp::InitInstance()
{
//初始化SDK
DSStream_Initialize();
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
// 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.
CLane_newDlg dlg;
//设置对话框背景色为黑色、文本为白色
SetDialogBkColor(RGB(0,0,0),RGB(255,255,255));
m_pMainWnd = &dlg;
int 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;
}
// 返回可执行文件的绝对路径。在制作安装盘时我们将声音文件、收费
// 站名称、汉字库文件都制作在安装盘中并在安装时拷贝到安装目录下,
// 程序运行时直接从安装目录下调用这些文件
void CLane_newApp::GetFullPath(char *pRetStr)
{
char pFullPath[130];
memset(pFullPath,0,130);
// 获取产生当前进程的可执行文件绝对路径
::GetModuleFileName(NULL,pFullPath,128);
char pDriver[6],pDir[130],pFileName[24],pFileExt[4];
memset(pDriver,0,6);
memset(pDir,0,130);
memset(pFileName,0,24);
memset(pFileExt,0,4);
// 将绝对路径分解为驱动器、目录、文件名及文件扩展名
_splitpath(pFullPath,pDriver,pDir,pFileName,pFileExt);
// 特别说明:在Win98下发现pDriver有"\",因此使用下面的语句
sprintf(pRetStr,"%s%s",pDriver,pDir);
// 在Win2000下发现pDriver不带"\",因此使用下面的语句
// 另(一):按MSDN的说明,pDriver不应带"\",不知为何Win98下不同
// (二):上述语句在Win2000下也可使用,估计Win2000可自动将
// "D:\\"识别为"D:\"
// sprintf(pFullPath,"%s\\%s",pDriver,pDir);
}
//对保存在车道的信息加密
void CLane_newApp::Encrypt(char *Source,char *Result,int len)
{
for(int i=0;i<len;i++) {
Result[i]=Source[i]+0x80;
}
}
int CLane_newApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
//释放SDK资源
DSStream_Uninitialize();
return CWinApp::ExitInstance();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -