📄 firstdlg.cpp
字号:
// FirstDlg.cpp : implementation file
//
#include "stdafx.h"
#include "atrkfax.h"
#include "FirstDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData);
/////////////////////////////////////////////////////////////////////////////
// CFirstDlg dialog
CFirstDlg::CFirstDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFirstDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFirstDlg)
m_bHaveStartPage = FALSE;
m_strRecFile = _T("");
m_strRecPath = _T("");
m_strSendFile = _T("");
m_strStartPage = _T("");
m_strEndPage = _T("");
//}}AFX_DATA_INIT
}
void CFirstDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFirstDlg)
DDX_Control(pDX, IDC_1DLG_CMB_FAXCH, m_cmbFaxCh);
DDX_Check(pDX, IDC_CHECK_START_END, m_bHaveStartPage);
DDX_Text(pDX, IDC_EDIT_RECEIVE, m_strRecFile);
DDX_Text(pDX, IDC_EDIT_RECPATH, m_strRecPath);
DDX_Text(pDX, IDC_EDIT_SEND, m_strSendFile);
DDX_Text(pDX, IDC_EDIT_START, m_strStartPage);
DDX_Text(pDX, IDC_EDIT_END, m_strEndPage);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFirstDlg, CDialog)
//{{AFX_MSG_MAP(CFirstDlg)
ON_BN_CLICKED(IDC_1DLG_SENDFILE_BTN, On1dlgSendfileBtn)
ON_BN_CLICKED(IDC_1DLG_RECFILE_BTN, On1dlgRecfileBtn)
ON_BN_CLICKED(IDC_1DLG_APPENDFILE_BTN, On1dlgAppendfileBtn)
ON_BN_CLICKED(IDC_CHECK_START_END, OnCheckStartEnd)
ON_EN_CHANGE(IDC_EDIT_RECEIVE, OnChangeEditReceive)
ON_EN_CHANGE(IDC_EDIT_START, OnChangeEditStart)
ON_EN_CHANGE(IDC_EDIT_END, OnChangeEditEnd)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFirstDlg message handlers
void CFirstDlg::On1dlgSendfileBtn()
//发送文件名
{
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, szCurrentPath);
cf.m_ofn.lpstrInitialDir = path;
if(cf.DoModal() == IDOK)
{
strcpy(m_strSendFile.GetBuffer(MAX_PATH), cf.GetFileName());
strcpy(szSendPathFile, cf.GetPathName());
UpdateData(FALSE);
m_strSendFile.ReleaseBuffer(-1);
}
}
void CFirstDlg::On1dlgRecfileBtn()
//接收文件名路径
{
char t[] = "请选择存放接收传真文件的路径";
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_strRecPath.GetBuffer(MAX_PATH)) )
{
UpdateData(FALSE);
}
pMalloc->Free(pidl);
pMalloc->Release();
}
}
}
BOOL CFirstDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
bHaveAppend = FALSE;
bHaveStartPage = FALSE;
strcpy(szSendPathFile,"");
strcpy(szRecPathFile,"");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CFirstDlg::GetCurrentPath(LPSTR str)
{
strcpy(szCurrentPath, str);
return TRUE;
}
/*int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
{
TCHAR szDir[MAX_PATH];
switch(uMsg)
{
case BFFM_INITIALIZED:
if(GetCurrentDirectory(sizeof(szDir)/sizeof(TCHAR),szDir))
{
strcat(szDir,"\\FaxFile");
::SendMessage(hwnd,BFFM_SETSELECTION,TRUE,(LPARAM)szDir);
}
break;
case BFFM_SELCHANGED:
if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir))
{
::SendMessage(hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)szDir);
}
break;
default:
break;
}
return 0;
}*/
void CFirstDlg::On1dlgAppendfileBtn()
{
/* 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, szCurrentPath);
cf.m_ofn.lpstrInitialDir = path;
if(cf.DoModal() == IDOK)
{
strcpy(m_strAppendFile.GetBuffer(MAX_PATH), cf.GetFileName());
strcpy(szAppendPathFile, cf.GetPathName());
UpdateData(FALSE);
m_strAppendFile.ReleaseBuffer(-1);
if(strlen(szAppendPathFile) >= 6)
bHaveAppend = TRUE;
else
bHaveAppend = FALSE;
}
*/
}
void CFirstDlg::OnCheckStartEnd()
{
UpdateData();
bHaveStartPage = m_bHaveStartPage;
CWnd *p = GetDlgItem(IDC_EDIT_START);
p->EnableWindow(bHaveStartPage);
p = GetDlgItem(IDC_EDIT_END);
p->EnableWindow(bHaveStartPage);
}
void CFirstDlg::OnChangeEditReceive()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
UpdateData();
}
void CFirstDlg::OnOK()
{
// TODO: Add extra validation here
//CDialog::OnOK();
}
void CFirstDlg::OnCancel()
{
// TODO: Add extra cleanup here
//CDialog::OnCancel();
}
void CFirstDlg::OnChangeEditStart()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
UpdateData();
if(m_strStartPage.IsEmpty())
nStartPage = 0;
else
nStartPage = atoi(m_strStartPage);
}
void CFirstDlg::OnChangeEditEnd()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
UpdateData();
if(m_strEndPage.IsEmpty())
nEndPage = 0;
else
nEndPage = atoi(m_strEndPage);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -