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

📄 phone_dlg.cpp

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

#include "stdafx.h"
#include "TrafficExecLaw.h"
#include "Phone_Dlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPhone_Dlg dialog
extern CTrafficExecLawApp theApp;


CPhone_Dlg::CPhone_Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPhone_Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPhone_Dlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CPhone_Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPhone_Dlg)
	DDX_Control(pDX, IDC_EDIT_CALLED_NUMBER, m_call_num);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPhone_Dlg, CDialog)
	//{{AFX_MSG_MAP(CPhone_Dlg)
	ON_WM_CLOSE()
	ON_BN_CLICKED(IDC_BUTTON_OK, OnButtonOk)
	ON_WM_DESTROY()
	ON_MESSAGE(WU_PHONE_NEW_COMEING_CALL,OnNewComingCall)
	ON_BN_CLICKED(IDC_BUTTON_NO, OnButtonNo)
	ON_BN_CLICKED(IDC_BUTTON_DEL, OnButtonDel)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPhone_Dlg message handlers

BOOL CPhone_Dlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPhone_Dlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	theApp.phonePort.pPhoneTrd ->PostThreadMessage (WU_PHONE_CLOSE,0,0);
	CDialog::OnClose();
}

void CPhone_Dlg::OnButtonOk() 
{
	// TODO: Add your control notification handler code here
	theApp.phonePort.ProbWrkSta=PROB_NONE;

	char str[64];
	CString telNum;

	this->m_call_num.GetWindowText (telNum);
	
	strcpy(str,"AT+CDV");
	strcat(str,WcharsToChars(telNum));
	strcat(str,"\r");

	theApp.phonePort.Send (str);
	theApp.phonePort.GetNextText (str);

	if(strcmp(str,"OK")!=0)
	{
		telNum+=L"-语音拨叫失败";
		MessageBox(telNum);
	}
}



void  CPhone_Dlg::OnNewComingCall()
{
	CString str;
	char text[64];


	theApp.phonePort.Send ("AT+CNI?\r");
	theApp.phonePort.GetNextText (text); 
	str=text;

	if(MessageBox(str,L"新的语音呼叫",MB_YESNO)==IDYES)
	{
		theApp.phonePort.Send ("AT$QCCAV\r");
		theApp.phonePort.ProbWrkSta=PROB_HANGUP;
	}
	else  OnButtonNo();
}




BOOL CPhone_Dlg::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	// TODO: Add your specialized code here and/or call the base class
	int ID=wParam & 0xffff;
	TCHAR c;

	if(ID>=IDC_BUTTON_0 && ID<=IDC_BUTTON_WELL)
	{

		if(ID==IDC_BUTTON_WELL)
			c=L'#';
		else if(ID==IDC_BUTTON_STAR)
			 c=L'*';
		else
             c=(ID-IDC_BUTTON_0)+L'0';

		this->m_call_num.SendMessage (WM_CHAR,c,0);
	}

	return CDialog::OnCommand(wParam, lParam);
}

void CPhone_Dlg::OnDestroy() 
{
	CDialog::OnDestroy();
	
	// TODO: Add your message handler code here
}

void CPhone_Dlg::OnButtonNo() 
{
	// TODO: Add your control notification handler code here
	char buf[32];

	theApp.phonePort.Send ("AT+CHV0\r");
	theApp.phonePort.GetNextText (buf);
	while(theApp.phonePort.GetNextText (buf)>0);
    theApp.phonePort.ProbWrkSta =PROB_INCOMING_CALL;

}

void CPhone_Dlg::OnButtonDel() 
{
	// TODO: Add your control notification handler code here
	this->m_call_num.SendMessage (WM_CHAR,VK_BACK,0);

}

⌨️ 快捷键说明

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