www.pudn.com > QRAPPuie.rar > Ivrdlg.cpp


// Ivrdlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "QRAPP2.h" 
#include "Ivrdlg.h" 
#include "astdtapi.h" 
#include "QRAPP2Dlg.h" 
 
// CIvrdlg dialog 
 
IMPLEMENT_DYNAMIC(CIvrdlg, CDialog) 
 
CIvrdlg::CIvrdlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CIvrdlg::IDD, pParent) 
	, m_szSub(_T("")) 
	, m_szIntr(_T("")) 
	, m_szCt(_T("")) 
	, m_szMobile(_T("")) 
{ 
 
} 
 
CIvrdlg::~CIvrdlg() 
{ 
} 
 
void CIvrdlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	DDX_Control(pDX, IDC_EDIT1, m_ctrlSubject); 
	DDX_Control(pDX, IDC_EDIT_INTRUCTION, m_ctrlIntr); 
	DDX_Control(pDX, IDC_EDIT3, m_ctrlMobile); 
} 
 
 
BEGIN_MESSAGE_MAP(CIvrdlg, CDialog) 
	ON_COMMAND(ID_RETURN32807, &CIvrdlg::OnReturn32807) 
	ON_BN_CLICKED(IDC_BUTTON_Listen, &CIvrdlg::OnBnClickedButtonListen) 
	ON_BN_CLICKED(IDC_BUTTON_RECOMMEND, &CIvrdlg::OnBnClickedButtonRecommend) 
	ON_COMMAND(ID_OPTION_GETQRCODE32800, &CIvrdlg::OnOptionGetqrcode32800) 
	ON_COMMAND(ID_OPTION_SAVETOFILE32801, &CIvrdlg::OnOptionSavetofile32801) 
	ON_WM_PAINT() 
	ON_WM_CTLCOLOR() 
	ON_WM_ACTIVATE() 
END_MESSAGE_MAP() 
 
 
// CIvrdlg message handlers 
 
BOOL CIvrdlg::OnInitDialog() 
{ 
	CDialog::OnInitDialog(); 
 
	// TODO:  Add extra initialization here 
	if (!m_dlgCommandBar.Create(this) || 
	    !m_dlgCommandBar.InsertMenuBar(IDR_MENU_IVR)) 
	{ 
		TRACE0("Failed to create CommandBar\n"); 
		return FALSE;      // fail to create 
	} 
	m_ctrlSubject.SetWindowTextW(m_szSub); 
	m_ctrlIntr.SetWindowTextW(m_szIntr); 
	m_ctrlMobile.SetWindowTextW(m_szMobile); 
 
	GetDlgItem(IDC_STATIC_SERVICENUM)->SetFocus(); 
	return FALSE;  // return TRUE unless you set the focus to a control 
	// EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CIvrdlg::OnReturn32807() 
{ 
	// TODO: Add your command handler code here 
	CDialog::OnOK(); 
} 
 
void CIvrdlg::OnBnClickedButtonListen() 
{ 
	// TODO: Add your control notification handler code here 
	LONG lResult; 
	lResult = tapiRequestMakeCall(m_szCt,NULL,NULL,NULL); 
} 
 
void CIvrdlg::OnBnClickedButtonRecommend() 
{ 
	// TODO: Add your control notification handler code here 
	CString strBody; 
	strBody = TEXT("业务名称:")+m_szSub; 
	strBody += TEXT(";业务介绍:")+m_szIntr; 
	if (!m_szCt.IsEmpty()) 
		strBody += TEXT(";IVR接入号:")+m_szCt; 
	if (!m_szMobile.IsEmpty()) 
		strBody += TEXT(";客服电话:")+m_szMobile; 
 
	LPWSTR p = NULL; 
	CString starts(TEXT("-service \"SMS\" -body \"" )); 
	m_AppMenuFunc.AddBeforeQuotation(strBody,&p); 
	CString szCmdLine = starts + p; 
	if (p!= NULL) 
	{ 
		delete []p; 
		p=NULL; 
	} 
	szCmdLine = szCmdLine + TEXT("\""); 
 
	m_AppMenuFunc.CreateTmailProcess(szCmdLine); 
 
 
} 
 
void CIvrdlg::OnOptionGetqrcode32800() 
{ 
	// TODO: Add your command handler code here 
	CDialog::OnOK(); 
	CQRAPP2Dlg dlg; 
	dlg.OnBnClickedButtonGetqrcode(); 
} 
 
void CIvrdlg::OnOptionSavetofile32801() 
{ 
	// TODO: Add your command handler code here 
	m_AppMenuFunc.SaveAsInfofile(m_szInformation); 
} 
 
void CIvrdlg::OnPaint() 
{ 
///	CPaintDC dc(this); // device context for painting 
	// TODO: Add your message handler code here 
	// Do not call CDialog::OnPaint() for painting messages 
 
	CRect rect; 
	CPaintDC dc(this); 
	GetClientRect(rect); 
	dc.FillSolidRect(rect,RGB(206,214,255)); //设置为绿色背景 
	CDialog::OnPaint(); 
} 
 
HBRUSH CIvrdlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{ 
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); 
 
	// TODO:  Change any attributes of the DC here 
	 if(CTLCOLOR_STATIC == nCtlColor) 
	 { 
		 pDC->SetBkColor(RGB(206,214,255));                   //背景色为白206 214 225  
		 pDC->SetTextColor(RGB(0,0,0));                           
		 hbr   =   CreateSolidBrush(RGB(206,214,255));       
 
	 } 
 
	// TODO:  Return a different brush if the default is not desired 
	return hbr; 
} 
void CIvrdlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) 
{ 
	CDialog::OnActivate(nState, pWndOther, bMinimized); 
 
	// TODO: Add your message handler code here 
	if (nState == WA_ACTIVE) 
	{ 
		DEVMODE mode= {0}; 
		mode.dmSize = sizeof(DEVMODE); 
		mode.dmFields = DM_DISPLAYORIENTATION; 
		::ChangeDisplaySettingsEx(NULL, &mode, 0, CDS_TEST, NULL); 
		if (mode.dmDisplayOrientation != DMDO_0) 
			::ChangeDisplaySettingsEx(NULL, &g_devModeForqr, NULL, 0, NULL); 
	} 
 
}