📄 lanesoft.cpp
字号:
// LaneSoft.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "LaneSoft.h"
#include "MainFrm.h"
#include "LaneSoftDoc.h"
#include "LaneSoftView.h"
#include "IniData.h"
#include "BCEncode.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLaneSoftApp
BEGIN_MESSAGE_MAP(CLaneSoftApp, CWinApp)
//{{AFX_MSG_MAP(CLaneSoftApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLaneSoftApp construction
CLaneSoftApp::CLaneSoftApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CLaneSoftApp object
CLaneSoftApp theApp ;
CIniData theIniData;
CMainFrame * m_pMainFrame;
CLaneSoftView * m_pMainView;
//注册表基本信息变量
CString g_Server_Ip_Address;
int g_Server_Port;
int g_Lane_No;
int g_Print;
CString g_LiuShuiHao;
CString g_Txj_Ip_Address;
int g_Txj_Port;
CString g_Station_Name;
int g_code;//条码检验
int g_check;//验票检验
///////////////////////
BOOL m_BClose;
BOOL m_BCloseTime;
BOOL m_BCloseTxj ;
BOOL m_BCloseTxjTime;
CString m_TxjRead ;
CString m_TxjSBYChexing ;
//barcode
DWORD err;
BOOL Above;
int Readable;
int Rotate;
int BType;
int Height;
int Wide;
int Narrow;
CString strText;
PDFSETTINGS pdfSetting;
//barcode
//mmb
BOOL g_mmb ;
BOOL g_mmbd ;
BOOL g_feb ;
BOOL g_febd ;
//mmb
BOOL Msgflag;
/////////////////////////////////////////////////////////////////////////////
// CLaneSoftApp initialization
BOOL CLaneSoftApp::InitInstance()
{
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// 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.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
// SetRegistryKey(_T("Local AppWizard-Generated Applications"));
SetRegistryKey("车道参数") ;
g_Server_Ip_Address = theApp.GetProfileString("信息","IP地址","") ;
g_Server_Port = theApp.GetProfileInt("信息","插口号",0);
g_Lane_No = theApp.GetProfileInt("信息","车道号",0);
g_Print = theApp.GetProfileInt("信息","打印检验",0);
g_code=theApp.GetProfileInt("信息","条形码检验",0);
g_check=theApp.GetProfileInt("信息","验票检验",0);
g_LiuShuiHao = theApp.GetProfileString("信息","流水号","") ;
g_Txj_Ip_Address = theApp.GetProfileString("信息","图像IP","") ;
g_Txj_Port = theApp.GetProfileInt("信息","图像插口",0);
g_Station_Name = theApp.GetProfileString("信息","站名称","") ;
//SocketBool
m_BClose = false ;
m_BCloseTime = false ;
m_BCloseTxj = false ;
m_BCloseTxjTime = false ;
g_mmb = true ;
g_mmbd = true ;
g_feb = true ;
g_febd = true ;
Msgflag=true;
// m_TxjSBYChexing = "Z0501" ;
//barcode
strText = "Y20010823160000";//条码数值的初始化
Narrow = 2;
Wide = 2;
Height = 20;
Above = FALSE;
BType = CODE128;
Rotate = ROTATE_0;
Readable = FALSE;
err = ENABLE_DISPLAY_ALL_MESSAGE;
pdfSetting.nCols = 0;
pdfSetting.nRows = 0;
pdfSetting.nEccLevel = 1;
pdfSetting.nRotate = Rotate;
pdfSetting.xScale = 2;
pdfSetting.yScale = 6;
//barcode
theIniData.m_dColor_Frm1 = RGB(192,192,192);
theIniData.m_dColor_Text1 = RGB(255,0,0);
theIniData.m_dColor_Text2 = RGB(0,255,0);
theIniData.m_dColor_Text3 = RGB(0,255,255);
theIniData.m_dColor_Text4 = RGB(0,0,0);
theIniData.m_dColor_Text5 = RGB(200,200,0);
theIniData.m_dColor_Text6 = RGB(140,140,140);
theIniData.m_dColor_Text7 = RGB(153,102,0);
theIniData.m_dColor_Text8 = RGB(110,110,110);
theIniData.m_dColor_BK1 = RGB(134,153,94);
LOGFONT lf;
lf.lfHeight = 50;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = FW_HEAVY;
lf.lfItalic = FALSE;
lf.lfUnderline = FALSE;
lf.lfStrikeOut = FALSE;
lf.lfCharSet = ANSI_CHARSET;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = DRAFT_QUALITY;
lf.lfPitchAndFamily = VARIABLE_PITCH|FF_MODERN;
strcpy(lf.lfFaceName,"Courier New");
theIniData.m_fFont1.CreateFontIndirect(&lf);
lf.lfHeight = 18 ; lf.lfWeight = FW_NORMAL;
theIniData.m_fFont2.CreateFontIndirect(&lf);
lf.lfHeight = 20 ; lf.lfWeight = FW_HEAVY; lf.lfCharSet = GB2312_CHARSET;
strcpy(lf.lfFaceName,"楷体_GB2312");
theIniData.m_fFont3.CreateFontIndirect(&lf);
lf.lfHeight = 32 ; lf.lfWidth = 12;
strcpy(lf.lfFaceName,"文鼎粗魏碑");
theIniData.m_fFont4.CreateFontIndirect(&lf);
lf.lfHeight = 25 ;
strcpy(lf.lfFaceName,"文鼎中行书");
theIniData.m_fFont5.CreateFontIndirect(&lf);
lf.lfHeight = 25 ;
strcpy(lf.lfFaceName,"宋体");
theIniData.m_fFont6.CreateFontIndirect(&lf);
lf.lfHeight = 35 ;
strcpy(lf.lfFaceName,"宋体");
theIniData.m_fFont7.CreateFontIndirect(&lf);
lf.lfHeight = 55 ;
strcpy(lf.lfFaceName,"文鼎中行书");
theIniData.m_fFont8.CreateFontIndirect(&lf);
lf.lfHeight = 12 ;
lf.lfWidth = 8;
strcpy(lf.lfFaceName,"宋体");
theIniData.m_fFont9.CreateFontIndirect(&lf);
SetDialogBkColor(theIniData.m_dColor_Frm1,theIniData.m_dColor_Text1);
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CLaneSoftDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CLaneSoftView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CLaneSoftApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CLaneSoftApp message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -