📄 atrkfaxdlg.cpp
字号:
{
CDialog::OnDestroy();
SsmFreeIndexData(1);
SsmFreeIndexData(2);
SsmCloseCti();
}
void CAtrkFaxDlg::OnTimer(UINT nIDEvent)
{
myScanATrunkCh(); //处理外线通道
myScanFaxCh(); //处理传真通道
myUpDateATrunkChListCtrl(); //处理外线通道显示
myUpdateChInfoList(); //处理传真通道显示
CDialog::OnTimer(nIDEvent);
}
//add by mjb 2001.11.15
void CAtrkFaxDlg::OnHangup()
{
for( int i=0;i< m_nTotalCh;i++)
{
if( SsmGetChType(i) != FAX_CH
&& SsmGetChType(i) != SOFTFAX_CH) continue;
SsmFaxSetHangup(i,1);
}
}
//add by mjb 2001.11.15
void CAtrkFaxDlg::OnNohangup()
{
for( int i=0;i< m_nTotalCh;i++)
{
if( SsmGetChType(i) != FAX_CH
&& SsmGetChType(i) != SOFTFAX_CH) continue;
SsmFaxSetHangup(i,0);
}
}
//add by mjb 2001.11.15
void CAtrkFaxDlg::OnAppend()
{
CString str,str2;
str.Format("nothing!\n");
for( int i=0;i< m_nTotalCh;i++)
{
if( SsmGetChType(i) != FAX_CH
&& SsmGetChType(i) != SOFTFAX_CH) continue;
if( SsmFaxAppendSend(i,m_fnAppendFaxFile)==0 )
{
str2.Format("%d# channel append!\n",i);
str += str2;
}
}
MessageBox(str);
}
void CAtrkFaxDlg::OnSelfn()
{
/* CFileDialog cf(1, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Fax File(*.fax)|*.fax|Tif File(*.tif)|*.tif|Tiff File(*.tiff)|*.tiff|All File(*.*)|*.*|",NULL);
char path[200];
strcpy(path,m_szCurPath);
strcat(path,"\\FaxFile");
cf.m_ofn.lpstrInitialDir = path;
if(cf.DoModal() == IDOK)
{
strcpy(m_fnAppendFaxFile, cf.GetFileName());
SetDlgItemText(IDC_APPENDFN,m_fnAppendFaxFile);
strcpy(m_fnAppendFaxFile, cf.GetPathName());
}*/
}
void CAtrkFaxDlg::OnCheckStartPage()
{
/*UpdateData();
CWnd *p=GetDlgItem(IDC_EDIT_START_PAGE);
p->EnableWindow(m_bStartPage);
p=GetDlgItem(IDC_EDIT_END_PAGE);
p->EnableWindow(m_bStartPage);*/
}
/*void CAtrkFaxDlg::GetStartPage()
{
CString str ;
GetDlgItemText(IDC_EDIT_START_PAGE,str);
str.TrimLeft();
str.TrimRight();
if (str.IsEmpty())
m_nStartPage = 0;
else
m_nStartPage = atoi(str);
GetDlgItemText(IDC_EDIT_END_PAGE,str);
str.TrimLeft();
str.TrimRight();
if (str.IsEmpty())
m_nEndPage = 0;
else
m_nEndPage = atoi(str);
}
*/
void CAtrkFaxDlg::OnButtonStopFax()
{
CString str;
int n,m;
m_cmbFaxCh.GetWindowText(str);
if(str.IsEmpty())
{
MessageBox("设置传真通道号"," 注意",MB_OK);
return;
}
else
n = atoi(str);
m = SsmFaxStop(n);
if(m ==-1)
{
str.Format("通道%d传真停止失败",n);
MessageBox(str,"失败",MB_OK);
}
else
{
str.Format("通道%d传真支持成功",n);
MessageBox(str,"成功",MB_OK);
}
//SsmPickup(2);
//SsmPickup(3);
}
void CAtrkFaxDlg::OnButton1()
{
CString str;
static int n = 0;
UpdateData();
m_cmbCurCh.GetWindowText(str);
if(str.IsEmpty())
{
MessageBox("请选择通道","注意",MB_OK);
return;
}
n = atoi(str);
if(m_strRecordFile.IsEmpty())
{
MessageBox("请选择文件名","注意",MB_OK);
return ;
}
SsmRecToFile(n,m_strRecordFile.GetBuffer(m_strRecordFile.GetLength()) ,-1,0,-1,-1,0);
}
void CAtrkFaxDlg::OnButton2()
{
CString str;
int n;
UpdateData();
m_cmbCurCh.GetWindowText(str);
if(str.IsEmpty())
{
MessageBox("请选择通道","注意",MB_OK);
return;
}
n = atoi(str);
SsmHangup(n);
//SsmStopRecToFile(n);//,m_strRecordFile.GetBuffer(m_strRecordFile.GetLength()) ,-1,0,-1,-1,0);
}
void CAtrkFaxDlg::OnViewmansendfaxfile()
{
// TODO: Add your control notification handler code here
/* CFileDialog cf(1, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Fax File(*.fax)|*.fax|Tif File(*.tif)|*.tif|Tiff File(*.tiff)|*.tiff|All File(*.*)|*.*|",NULL);
cf.m_ofn.lpstrInitialDir = m_szCurPath;
if(cf.DoModal() == IDOK)
{
strcpy(m_strManSendFaxFile.GetBuffer(MAX_PATH), cf.GetFileName());
strcpy(m_szManSendFaxFile, cf.GetPathName());
UpdateData(FALSE);
m_strManSendFaxFile.ReleaseBuffer(-1);
}*/
}
void CAtrkFaxDlg::OnAutocall()
{
// TODO: Add your control notification handler code here
/*UpdateData(TRUE);
//int nCurSelCh = m_ctlCurCh.GetCurSel();
if(nCurSelCh < 0)
{
AfxMessageBox(_T("Please select a channel!!!"));
return;
}
CString str;
int nManualSendTrkCh;
//m_ctlCurCh.GetLBText(nCurSelCh , str);
nManualSendTrkCh = atoi((LPTSTR)(LPCSTR)(LPCTSTR)str);
if(SsmGetChState(nManualSendTrkCh) != S_CALL_STANDBY)
{
AfxMessageBox(_T("this channel is busying"));
return;
}
SsmPickup(nManualSendTrkCh);*/
}
void CAtrkFaxDlg::WriteLog(char *szLog)
{
if(FALSE == m_bLog)
return;
CString szWriteLog;
SYSTEMTIME st;
GetLocalTime(&st);
szWriteLog.Format("%04d-%02d-%02d %02d:%02d:%02d : %s\n" , st.wYear , st.wMonth , st.wDay , st.wHour , st.wMinute , st.wSecond , szLog);
fwrite((LPCTSTR)szWriteLog , szWriteLog.GetLength() , 1 , m_LogFile);
fflush(m_LogFile);
}
void CAtrkFaxDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
CRect tabRect, itemRect;
int nX, nY, nXc, nYc;
m_TabCtrl.GetClientRect(&tabRect);
m_TabCtrl.GetItemRect(0, &itemRect);
nX=itemRect.left+22+400 ;
nY=itemRect.bottom+90+200- 10;
nXc=tabRect.right-itemRect.left -30;
nYc=tabRect.bottom-nY+20+200+40;
switch (m_nTabShow)
{
case 0:
m_TabCtrl.SetCurSel(0);
m_firstDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
m_secondDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_thirdDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
break;
case 1:
m_TabCtrl.SetCurSel(1);
m_firstDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_secondDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
m_thirdDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
break;
case 2:
m_TabCtrl.SetCurSel(2);
m_firstDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_secondDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
m_thirdDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
break;
}
}
void CAtrkFaxDlg::OnSelchangingTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = 0;
}
void CAtrkFaxDlg::AutoSendFax()
{
int nTrunk,nFaxCh;
CString str;
// MessageBox("Ok1");
m_secondDlg.m_cmbTrunkCh.GetWindowText(str);
nTrunk = atoi(str);
str.ReleaseBuffer(-1);
m_secondDlg.m_cmbFaxCh.GetWindowText(str);
nFaxCh = atoi(str);
m_ATrkCh[nTrunk].toFaxCh = nFaxCh;
sprintf(m_ATrkCh[nTrunk].pPhoNum,"%s", m_secondDlg.m_strCallNo);
sprintf(m_FaxCh[nFaxCh].szSendPathFile,"%s",m_secondDlg.szSendFile);
//传真追加发送
//
if((nFaxCh=SsmPickup(nTrunk)) == -1)
{
MessageBox("SsmPickup Fail","Fail",MB_OK);
SsmHangup(nTrunk);
}
}
void CAtrkFaxDlg::AutoSendFaxEx()
{
int nTrunk,nFaxCh;
CString str;
// MessageBox("Ok1");
m_secondDlg.m_cmbTrunkCh.GetWindowText(str);
nTrunk = atoi(str);
str.ReleaseBuffer(-1);
m_secondDlg.m_cmbFaxCh.GetWindowText(str);
nFaxCh = atoi(str);
m_ATrkCh[nTrunk].toFaxCh = nFaxCh;
sprintf(m_ATrkCh[nTrunk].pPhoNum,"%s", m_secondDlg.m_strCallNo);
sprintf(m_FaxCh[nFaxCh].szSendPathFile,"%s",m_secondDlg.szSendFile);
//传真追加发送
//
if((nFaxCh=SsmPickup(nTrunk)) == -1)
{
MessageBox("SsmPickup Fail","Fail",MB_OK);
SsmHangup(nTrunk);
}
}
void CAtrkFaxDlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int n = m_TabCtrl.GetCurSel();
/*if(n != m_nTabShow)
{
for(int i=0; i< m_nTotalCh; i++)
{
if(m_ATrkCh[i].EnCalled && m_ATrkCh[i].nShow != n && m_ATrkCh[i].Step != TRK_IDLE)
{
m_TabCtrl.SetCurSel(m_nTabShow);
MessageBox("注意:目前有通道在工作,无法切换传真工作模式","注意",MB_OK);
return ;
}
}
}*/
switch(n)
{
case 0:
m_nTabShow = 0;
m_firstDlg.ShowWindow(SW_SHOW);
m_secondDlg.ShowWindow(SW_HIDE);
m_thirdDlg.ShowWindow(SW_HIDE);
break;
case 1:
m_nTabShow = 1;
m_firstDlg.ShowWindow(SW_HIDE);
m_secondDlg.ShowWindow(SW_SHOW);
m_thirdDlg.ShowWindow(FALSE);
break;
case 2:
m_nTabShow = 2;
m_firstDlg.ShowWindow(0);
m_secondDlg.ShowWindow(0);
m_thirdDlg.ShowWindow(1);
break;
}
*pResult = 0;
}
void CAtrkFaxDlg::OnBUTTONAppendSend()
{
{
CFileDialog cf(1, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Fax File(*.tif)|*.tif|Tif File(*.fax)|*.fax|Tiff File(*.tiff)|*.tiff|All File(*.*)|*.*|",NULL);
char path[MAX_PATH];
strcpy(path, m_szCurPath);
cf.m_ofn.lpstrInitialDir = path;
if(cf.DoModal() == IDOK)
{
//strcpy(m_strAppendFile.GetBuffer(MAX_PATH), cf.GetFileName());
strcpy(m_strAppendSendFile.GetBuffer(MAX_PATH), cf.GetPathName());
UpdateData(FALSE);
m_strAppendSendFile.ReleaseBuffer(-1);
}
}
}
void CAtrkFaxDlg::OnButtonAppend()
{
CString str;
int n,m;
m_cmbFaxCh.GetWindowText(str);
if(str.IsEmpty())
{
MessageBox("设置传真通道","注意",MB_OK);
}
else
n = atoi(str);
m = SsmFaxAppendSend(n, m_strAppendSendFile.GetBuffer(m_strAppendSendFile.GetLength()));
if(m == -1)
{
str.Format("通道%d追加失败",n);
MessageBox(str,"注意",MB_OK);
}
else
{
str.Format("通道%d追加成功",n);
MessageBox(str,"成功",MB_OK);
}
}
void CAtrkFaxDlg::OnCHECKMultiChRec()
{
// TODO: Add your control notification handler code here
UpdateData();
}
void CAtrkFaxDlg::OnCHECKSetRexMixer()
{
CString str;
int n;
UpdateData();
m_cmbCurCh.GetWindowText(str);
if(str.IsEmpty())
{
MessageBox("请设置通道号","注意",MB_OK);
return ;
}
n = atoi(str);
n = SsmSetRecMixer(n, m_bSetMixer,0);
if(n ==-1)
MessageBox("SsmSetRecMixer Error","Error",MB_OK);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -