📄 acceptdlg.cpp
字号:
// AcceptDlg.cpp : implementation file
//
#include "stdafx.h"
#include "netpro.h"
#include "tapiutils.h"
#include "netprodlg.h"
#include "Callntfy.h"
#include "AcceptDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAcceptDlg dialog
//CAcceptDlg::CAcceptDlg(CWnd* pParent /*=NULL*/)
// : CDialog(CAcceptDlg::IDD, pParent)
//{
// //{{AFX_DATA_INIT(CAcceptDlg)
// // NOTE: the ClassWizard will add member initialization here
// //}}AFX_DATA_INIT
//}
CAcceptDlg::CAcceptDlg(CCallNotify* m_CallNotify)
{
//{{AFX_DATA_INIT(CAcceptDlg)
m_cSUB = _T("");
//}}AFX_DATA_INIT
m_pCallNotify = m_CallNotify;
Timer = 0;
}
void CAcceptDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAcceptDlg)
DDX_Text(pDX, IDC_SUBSCRIBER, m_cSUB);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAcceptDlg, CDialog)
//{{AFX_MSG_MAP(CAcceptDlg)
ON_WM_TIMER()
ON_BN_CLICKED(ID_ACCEPT, OnAccept)
ON_BN_CLICKED(ID_REJECT, OnReject)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAcceptDlg message handlers
void CAcceptDlg::OnTimer(UINT nIDEvent)
{
CDialog::OnTimer(nIDEvent);
BOOL why = MessageBeep(MB_OK);
counter++;
if (counter == 6)
{
KillTimer(Timer);
Timer=0;
m_pCallNotify->RejectCall();
DestroyWindow();
}
}
BOOL CAcceptDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CRect rect;
HWND hwnd;
hwnd = GetSafeHwnd();
::GetWindowRect(hwnd,rect);
::SetWindowLong(hwnd,GWL_EXSTYLE,::GetWindowLong(hwnd,GWL_EXSTYLE)|WS_EX_TOPMOST);
::SetWindowPos(hwnd,HWND_TOPMOST,rect.left,rect.top,rect.Width(),rect.Height(),
SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CAcceptDlg::KillDlgTimer()
{
KillTimer(Timer);
Timer = 0;
}
void CAcceptDlg::StartTimer()
{
MessageBeep(MB_OK);
counter=0;
if(!Timer)
{
Timer = SetTimer(NULL,3000,NULL);
// 1800000,
// NULL);
}
}
void CAcceptDlg::OnAccept()
{
KillTimer(Timer);
Timer=0;
m_pCallNotify->AcceptCall();
DestroyWindow();
}
void CAcceptDlg::OnReject()
{
KillTimer(Timer);
Timer = 0;
m_pCallNotify->RejectCall();
DestroyWindow();
}
void CAcceptDlg::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
}
BOOL CAcceptDlg::DestroyWindow()
{
// TODO: Add your specialized code here and/or call the base class
if(Timer!=0)
{
KillTimer(Timer);
Timer = 0;
}
return CDialog::DestroyWindow();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -