dialing.cpp

来自「用于电力工业中数据的采集、显示」· C++ 代码 · 共 94 行

CPP
94
字号
// Dialing.cpp : implementation file
//

#include "stdafx.h"
#include "wgl_32.h"
#include "Dialing.h"
#include "tty.h"

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

extern CTTY MyTTY;
/////////////////////////////////////////////////////////////////////////////
// CDialing dialog

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


void CDialing::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDialing)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDialing, CDialog)
	//{{AFX_MSG_MAP(CDialing)
	ON_WM_PAINT()
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDialing message handlers

BOOL CDialing::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	GetDlgItem(IDC_TELEPHONE)->GetWindowRect(&m_PhoneNumRect);
	ScreenToClient(&m_PhoneNumRect);
    SetTimer(19691, 500, NULL);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDialing::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	dc.SetBkMode(TRANSPARENT);
	dc.TextOut(m_PhoneNumRect.left+100, m_PhoneNumRect.top+30, m_strPhoneNumber);

	// Do not call CDialog::OnPaint() for painting messages
}


void CDialing::OnCancel() 
{
	// TODO: Add extra cleanup here
    KillTimer(19691);
	MyTTY.npTTYInfo->Queue[0] = 3;
	MyTTY.npTTYInfo->HeadPtr=1;
	EndDialog(IDCANCEL);
    CDialog::OnCancel();
}


void CDialing::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	DWORD Status;
    BOOL i = GetCommModemStatus(COMDEV(MyTTY.npTTYInfo ), &Status);
	if(i && (Status &MS_RLSD_ON))
	  {
	   KillTimer(19691);
	   EndDialog(1);
	  }
}

⌨️ 快捷键说明

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