?? phonerecorddlg.cpp
字號:
// PhoneRecordDlg.cpp : implementation file
//
#include "stdafx.h"
#include "PhoneRecord.h"
#include "PhoneRecordDlg.h"
#include "ClientDlg.h"
#include "EmployeeDlg.h"
#include "ManufactureDlg.h"
#include "RecordDlg.h"
#include "PhoneinDlg.h"
#include "PhoneoutDlg.h"
#include "Tc08a32.h"
#include "NewSig.h"
#include "PhoneBook.h"
#include "ADOConn.h"
#include "Logindlg.h"
#include "djcvt.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#pragma comment(lib,"djcvt")
#pragma comment (lib,"Tc08a32")
#pragma comment (lib,"NewSig")
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPhoneRecordDlg dialog
CPhoneRecordDlg::CPhoneRecordDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPhoneRecordDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPhoneRecordDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_ChanelCount = 0;
m_IsReceiving = FALSE;
m_CurNumber = "";
m_CurTime = "";
m_CurChanel = -1;
m_IsOffHook = TRUE;
m_RecordNum = -1;
m_IsBusy = FALSE;
}
void CPhoneRecordDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPhoneRecordDlg)
DDX_Control(pDX, IDC_PHONEBOOK, m_PhoneBook);
DDX_Control(pDX, IDC_EDIT1, m_PhoneNum);
DDX_Control(pDX, IDC_COMBO1, m_Chanel);
DDX_Control(pDX, IDC_DIALUP, m_Dialup);
DDX_Control(pDX, IDC_HANGUP, m_Hangup);
DDX_Control(pDX, IDC_RECORD, m_Record);
DDX_Control(pDX, IDC_PHONEOUT, m_PhoneOut);
DDX_Control(pDX, IDC_PHONEIN, m_PhoneIn);
DDX_Control(pDX, IDC_MANUFACTURE, m_Manufacture);
DDX_Control(pDX, IDC_LIST1, m_Grid);
DDX_Control(pDX, IDC_EMPLOYEE, m_Employee);
DDX_Control(pDX, IDC_CLIENT, m_Client);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPhoneRecordDlg, CDialog)
//{{AFX_MSG_MAP(CPhoneRecordDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_MESSAGE(WM_ONTRAY,OnTray)
ON_WM_CLOSE()
ON_COMMAND(ID_MENUSHOW, OnMenushow)
ON_COMMAND(ID_MENUHIDE, OnMenuhide)
ON_COMMAND(ID_MENUCLOSE, OnMenuclose)
ON_COMMAND(ID_MENUPHONEOUT, OnMenuphoneout)
ON_COMMAND(ID_MENUPHONEIN, OnMenuphonein)
ON_COMMAND(ID_MENURECORD, OnMenurecord)
ON_COMMAND(ID_MENUCLIENT, OnMenuclient)
ON_COMMAND(ID_MENUEMPLOYEES, OnMenuemployees)
ON_COMMAND(ID_MENUMANUFACTURE, OnMenumanufacture)
ON_COMMAND(ID_MENUABOUT, OnMenuabout)
ON_COMMAND(ID_MENUEXIT, OnMenuexit)
ON_WM_TIMER()
ON_BN_CLICKED(IDC_DIALUP, OnDialup)
ON_BN_CLICKED(IDC_HANGUP, OnHangup)
ON_BN_CLICKED(IDC_PHONEBOOK, OnPhonebook)
ON_BN_CLICKED(IDC_PHONEIN, OnPhonein)
ON_BN_CLICKED(IDC_PHONEOUT, OnPhoneout)
ON_BN_CLICKED(IDC_RECORD, OnRecord)
ON_BN_CLICKED(IDC_CLIENT, OnClient)
ON_BN_CLICKED(IDC_EMPLOYEE, OnEmployee)
ON_BN_CLICKED(IDC_MANUFACTURE, OnManufacture)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPhoneRecordDlg message handlers
BOOL CPhoneRecordDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
CLogindlg dlg;
if(dlg.DoModal() != IDOK)
{
CDialog::OnCancel();
}
m_Menu.LoadMenu(IDR_MENU2);
//添加系統托盤
char lpszTip[]="企業電話語音錄音管理系統";
NOTIFYICONDATA data;
data.cbSize = sizeof(NOTIFYICONDATA);
data.hWnd = m_hWnd;
lstrcpyn(data.szTip,lpszTip,sizeof(lpszTip));
data.uCallbackMessage = WM_ONTRAY;
data.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
data.hIcon = m_hIcon;
data.uID = IDR_MAINFRAME;
Shell_NotifyIcon(NIM_ADD,&data);
//加載驅動程序
/* if(LoadDRV()!=0)
MessageBox("加載驅動程序錯誤");
//檢查可用的通道數量
m_ChanelCount = CheckValidCh();
SetBusyPara(350);
EnableCard(m_ChanelCount,1024*32);*/
//設置列表視圖的擴展風格
m_Grid.SetExtendedStyle( LVS_EX_FLATSB //扁平風格顯示滾動條
| LVS_EX_FULLROWSELECT //允許整行選中
| LVS_EX_HEADERDRAGDROP //允許整列拖動
| LVS_EX_ONECLICKACTIVATE //單擊選中項
| LVS_EX_GRIDLINES ); //畫出網格線
//設置表頭
m_Grid.InsertColumn(0,"通道號" ,LVCFMT_LEFT,100,0);
m_Grid.InsertColumn(1,"通道類型",LVCFMT_LEFT,100,1);
m_Grid.InsertColumn(2,"電話號碼",LVCFMT_LEFT,150,2);
m_Grid.InsertColumn(3,"來電時間",LVCFMT_LEFT,150,3);
m_Grid.InsertColumn(4,"流程狀態",LVCFMT_LEFT,100,4);
m_pLines = new LINESTRUCT[m_ChanelCount];
CString convert;
for(int i = 0; i<m_ChanelCount; i++)
{
WORD type = CheckChType(i);
convert.Format("%i",i);
m_Grid.InsertItem(i,"");
m_Grid.SetItemText(i,0,convert);
m_pLines[i].State = CH_FREE;
m_pLines[i].IsReceiving = FALSE;
m_pLines[i].nType = type ;
// m_pLines[i].Inited = FALSE;
switch(type)
{
case 0: //內線
{
convert = "內線";
break;
}
case 1: //外線
{
m_Chanel.AddString(convert);
convert = "外線";
break;
}
case 2: //懸空
{
convert = "懸空";
break;
}
}
m_Grid.SetItemText(i,1,convert);
}
//初始化信號音函數
/* Sig_Init(0);
SetPackRate(PACK_32KBPS);
SetDialPara(1000,2000,350,10);
SetTimer(1,1,NULL);*/
return TRUE; // return TRUE unless you set the focus to a control
}
void CPhoneRecordDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CPhoneRecordDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CPhoneRecordDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CPhoneRecordDlg::OnTray(WPARAM wParam, LPARAM lParam)
{
UINT uMouseMsg = (UINT) lParam;
if(uMouseMsg == WM_RBUTTONDOWN)
{
CMenu* pPopup = m_Menu.GetSubMenu(0);
CPoint point;
GetCursorPos(&point);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_VERTICAL,
point.x,point.y,AfxGetApp()->m_pMainWnd,TPM_LEFTALIGN);
}
if(uMouseMsg==WM_LBUTTONDBLCLK) //雙擊鼠標
{
ShowWindow(SW_SHOWNOACTIVATE); //恢復窗口的顯示
}
}
void CPhoneRecordDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
CloseWindow();
ShowWindow(SW_HIDE);
// CDialog::OnClose();
}
void CPhoneRecordDlg::OnMenushow()
{
// TODO: Add your command handler code here
ShowWindow(SW_SHOWNOACTIVATE);
}
void CPhoneRecordDlg::OnMenuhide()
{
// TODO: Add your command handler code here
CloseWindow();
ShowWindow(SW_HIDE);
}
void CPhoneRecordDlg::OnMenuclose()
{
// TODO: Add your command handler code here
if(MessageBox("確定要退出企業電話語音錄音管理系統嗎?","系統提示",
MB_OKCANCEL|MB_ICONQUESTION)!=IDOK)
return;
//刪除系統托盤
NOTIFYICONDATA data;
data.cbSize = sizeof(NOTIFYICONDATA);
data.hWnd = m_hWnd;
data.uID = IDR_MAINFRAME;
Shell_NotifyIcon(NIM_DELETE,&data);
delete []m_pLines;
FreeDRV();
CDialog::OnCancel();
}
void CPhoneRecordDlg::OnMenuphoneout()
{
// TODO: Add your command handler code here
CPhoneoutDlg dlg;
if(dlg.DoModal()==IDOK)
{
m_PhoneNum.SetWindowText(dlg.m_Number);
OnDialup();
}
}
void CPhoneRecordDlg::OnMenuphonein()
{
// TODO: Add your command handler code here
CPhoneinDlg dlg;
if(dlg.DoModal()==IDOK)
{
m_PhoneNum.SetWindowText(dlg.m_Number);
OnDialup();
}
}
void CPhoneRecordDlg::OnMenurecord()
{
// TODO: Add your command handler code here
CRecordDlg* dlg = new CRecordDlg;
dlg->Create(IDD_RECORD_DIALOG,this);
dlg->ShowWindow(SW_SHOW);
}
void CPhoneRecordDlg::OnMenuclient()
{
// TODO: Add your command handler code here
CClientDlg* dlg = new CClientDlg;
dlg->Create(IDD_CLIENT_DIALOG,this);
dlg->ShowWindow(SW_SHOW);
}
void CPhoneRecordDlg::OnMenuemployees()
{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -