⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atrkfaxdlg.cpp

📁 三汇板卡测试DEMO,采用事件回凋函数实现.
💻 CPP
📖 第 1 页 / 共 4 页
字号:
		str.Format("Channel %d fax succeed",n);
		MessageBox(str,"Succeed",MB_OK);
	}

}


void CAtrkFaxDlg::OnButton1() 
{

		char t[] = "Please select fax file to send ";
		BROWSEINFO bi;
		LPMALLOC pMalloc;
		if(SUCCEEDED(SHGetMalloc(&pMalloc))) 
		{
			ZeroMemory(&bi,sizeof(bi));
			bi.hwndOwner		= NULL;
			bi.pszDisplayName	= 0;
			bi.lpszTitle		= t;
			bi.pidlRoot			= 0;
			bi.ulFlags			= BIF_RETURNONLYFSDIRS;
			bi.lpfn				= BrowseCallbackProc;

			LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
			if(pidl) 
			{
				if(SHGetPathFromIDList(pidl, m_strRecordFile.GetBuffer(MAX_PATH)) ) 
				{
					UpdateData(FALSE);
				}
				pMalloc->Free(pidl);
				pMalloc->Release();
			}
		}	
 }

void CAtrkFaxDlg::OnButton2() 
{
	CString str;
	int		n;
	UpdateData();
	m_cmbCurCh.GetWindowText(str);
	if(str.IsEmpty())
	{
		MessageBox("Please set channel","Warning",MB_OK);
		return;
	}
	n = atoi(str);
	SsmHangup(n);

}

void CAtrkFaxDlg::OnViewmansendfaxfile() 
{
	
}


void CAtrkFaxDlg::OnAutocall() 
{
	
}

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);
		m_forthDlg.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);
		m_forthDlg.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);
		m_forthDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
		break;
	case 3:
		m_TabCtrl.SetCurSel(3);
		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_HIDEWINDOW);
		m_forthDlg.SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
	}	
}

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);
	//append fax file

	//
	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);
	//append fax file

	//
	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();
 
	switch(n)
	{
	case 0:
		m_nTabShow = 0;
		m_firstDlg.ShowWindow(SW_SHOW);
		m_secondDlg.ShowWindow(SW_HIDE);
		m_thirdDlg.ShowWindow(SW_HIDE);
		m_forthDlg.ShowWindow(SW_HIDE);
		break;
	case 1:
		m_nTabShow = 1;
		m_firstDlg.ShowWindow(SW_HIDE);
		m_secondDlg.ShowWindow(SW_SHOW);
		m_thirdDlg.ShowWindow(FALSE);
		m_forthDlg.ShowWindow(SW_HIDE);
		break;
	case 2:
		m_nTabShow = 2;
		m_firstDlg.ShowWindow(0);
		m_secondDlg.ShowWindow(0);
		m_thirdDlg.ShowWindow(1);
		m_forthDlg.ShowWindow(SW_HIDE);
		break;
	case 3:
		m_nTabShow = 3;
		m_firstDlg.ShowWindow(0);
		m_secondDlg.ShowWindow(0);
		m_thirdDlg.ShowWindow(0);
		m_forthDlg.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("Set fax channel","Warning",MB_OK);
	}
	else
		n = atoi(str);

	m = SsmFaxAppendSend(n, m_strAppendSendFile.GetBuffer(m_strAppendSendFile.GetLength()));
	if(m == -1)
	{
		str.Format("Channel %d fail to append",n);
		MessageBox(str,"Warning",MB_OK);
	}
	else
	{
		str.Format("Channel %d succeed appending",n);
		MessageBox(str,"Successful",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("Please set channel Id","Warning",MB_OK);
		return ;
	}
	n = atoi(str);
	n = SsmSetRecMixer(n, m_bSetMixer,0);
	if(n ==-1)
		MessageBox("SsmSetRecMixer Error","Error",MB_OK);
}

void CAtrkFaxDlg::OnSingleFile() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	CWnd * p = GetDlgItem(IDC_EDIT_RecordFile);
	p->ShowWindow(0);
	p = GetDlgItem(IDC_BUTTON1);
	p->ShowWindow(0);
	p = GetDlgItem(IDC_BUTTON_ADDIN);

	p = GetDlgItem(IDC_EDIT_START_PAGE);
	p->EnableWindow(1);
	p = GetDlgItem(IDC_EDIT_END_PAGE);
	p->EnableWindow(1);
}

void CAtrkFaxDlg::OnMultiFile() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	CWnd * p = GetDlgItem(IDC_EDIT_RecordFile);
	p->ShowWindow(1);
	p = GetDlgItem(IDC_BUTTON1);
	p->ShowWindow(1);
	p = GetDlgItem(IDC_EDIT_START_PAGE);
	p->EnableWindow(0);
	p = GetDlgItem(IDC_EDIT_END_PAGE);
	p->EnableWindow(0);
}

void CAtrkFaxDlg::OnMultiFileSetPage() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	CWnd * p = GetDlgItem(IDC_EDIT_RecordFile);
	p->ShowWindow(0);
	p = GetDlgItem(IDC_BUTTON1);
	p->ShowWindow(0);
	p = GetDlgItem(IDC_EDIT_START_PAGE);
	p->EnableWindow(1);
	p = GetDlgItem(IDC_EDIT_END_PAGE);
	p->EnableWindow(1);
}

void CAtrkFaxDlg::OnBtnShowFile() 
{
	if(m_bHowFile == 0 || m_bHowFile == 2)
	{
		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_strSendPathFile.GetBuffer(MAX_PATH), cf.GetPathName());
			//strcpy(szSendPathFile, cf.GetPathName());
			UpdateData(FALSE);
			m_strSendPathFile.ReleaseBuffer(-1);
		}	

	}
	else if(m_bHowFile == 1)
	{
		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_strSendPathFile.GetBuffer(MAX_PATH), cf.GetPathName());
			strcpy(m_strSendPathFile.GetBuffer(MAX_PATH), cf.GetFileName());
			UpdateData(FALSE);
			m_strSendPathFile.ReleaseBuffer(-1);
		}	
	}



	
}

void CAtrkFaxDlg::OnButtonAddin() 
{	
	if(m_strSendPathFile.IsEmpty())	return;
	UpdateData();
	int n = m_ListBox.InsertString(-1, m_strSendPathFile);
	strcpy(ffSCT[m_nSCTNumber].szFileName, m_strSendPathFile);
	ffSCT[m_nSCTNumber].nStartPage  = m_nStartPage;
	ffSCT[m_nSCTNumber].nEndPage	= m_nEndPage;
	if(++m_nSCTNumber >= 50)
		m_nSCTNumber = 0;
	m_ListBox.SetCurSel(n);
}

void CAtrkFaxDlg::OnButtonDel() 
{
	// TODO: Add your control notification handler code here
	int m = m_ListBox.GetCurSel();
	if(m == -1)	return ;
	CString str;
	m_ListBox.GetText(m,str);
	m_ListBox.DeleteString(m);
	for(int n = 0; n < m_nSCTNumber; n++)
	{
		if(strcmp(ffSCT[n].szFileName, str) == 0 && m == n)
		{
			for(n = n + 1; n < m_nSCTNumber; n++)
			{
				memcpy(&ffSCT[n-1], &ffSCT[n], sizeof(FAX_FILE_SCT));
			}
			m_nSCTNumber--;
			if(m >= m_nSCTNumber)	m = 0;
			m_ListBox.SetCurSel(m);
			OnSelchangeListBoxShow();
			break;
		}
	}
}

void CAtrkFaxDlg::OnSelchangeListBoxShow() 
{
	int n = m_ListBox.GetCurSel();
	if(n == -1)	return;
	CString str;
	m_ListBox.GetText(n, str);
	for(int i = 0; i< m_nSCTNumber; i++)
	{
		if(strcmp(ffSCT[i].szFileName, str) == 0 && i == n)
		{
			m_nStartPage = ffSCT[i].nStartPage;
			m_nEndPage   = ffSCT[i].nEndPage;
			UpdateData(FALSE);
			break;
		}
	}
}

void CAtrkFaxDlg::OnDblclkListBoxShow() 
{
	// TODO: Add your control notification handler code here
	int n = m_ListBox.GetCurSel();
	if(n == -1)	return;
	CString str;
	m_ListBox.GetText(n, str);
	for(int i = 0; i< m_nSCTNumber; i++)
	{
		if(strcmp(ffSCT[i].szFileName, str) == 0 && i == n)
		{
			m_nStartPage = ffSCT[i].nStartPage;
			m_nEndPage   = ffSCT[i].nEndPage;
			UpdateData(FALSE);
			break;
		}
	}	
}

⌨️ 快捷键说明

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