⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchcar_dlg.cpp

📁 wince下交警执法程序源码,使用evc编写
💻 CPP
字号:
// SearchCar_Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "TrafficExecLaw.h"
#include "SearchCar_Dlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSearchCar_Dlg dialog


CSearchCar_Dlg::CSearchCar_Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSearchCar_Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSearchCar_Dlg)
	m_car_tablet = _T("");
	m_type = _T("");
	m_engine_number = _T("");
	m_useless_date = _T("");
	//}}AFX_DATA_INIT
}


void CSearchCar_Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSearchCar_Dlg)
	DDX_Text(pDX, IDC_EDIT_car_tablet, m_car_tablet);
	DDX_Text(pDX, IDC_EDIT_car_type, m_type);
	DDX_Text(pDX, IDC_EDIT_engine_number, m_engine_number);
	DDX_Text(pDX, IDC_EDIT_useless_date, m_useless_date);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSearchCar_Dlg, CDialog)
	//{{AFX_MSG_MAP(CSearchCar_Dlg)
	ON_BN_CLICKED(IDC_BUTTON_search, OnBUTTONsearch)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSearchCar_Dlg message handlers
extern CTrafficExecLawApp theApp;

void CSearchCar_Dlg::OnBUTTONsearch() 
{
	// TODO: Add your control notification handler code here
    Get_CarInfo_Param  param;
    Car_Info ci;

    this->GetDlgItem (IDC_EDIT_tablet)
		 ->GetWindowText(param.m_car_tablet ,10);
    param.m_srvCode =GET_CAR_INFO;

	CSocket s;
	int v;

    v=s.Create(4000,SOCK_STREAM);
	if(v==0)goto error;

	v=s.Connect (theApp.databaseSrvIP,8888);
	if(v==0)goto error;

	v=s.Send(&param,sizeof(param),8888);
	if(v!=sizeof(param))
		goto error;

	v=s.Receive(&ci,sizeof(ci));
	
	if(wcscmp(ci.m_car_tablet,param.m_car_tablet)==0)
	{

		m_car_tablet = ci.m_car_tablet ;
		m_type =ci.m_type;
		m_engine_number = ci.m_engine_number;
		m_useless_date.Format (L"%d", ci.m_useless_date);
		this->UpdateData (FALSE);
	}
	else
	{
	
		MessageBox(L"找不到指定的车辆信息!");
	}	
	


	
error:

	if(v==0)
	{
		MessageBox(L"网络错误!");
	}

	s.ShutDown ();
	s.Close ();


}

BOOL CSearchCar_Dlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	

	// TODO: Add extra initialization here

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -