|
@@ -140,6 +140,8 @@ BEGIN_MESSAGE_MAP(CMFCApplication1Dlg, CDialogEx)
|
|
ON_BN_CLICKED(IDOK, &CMFCApplication1Dlg::OnBnClickedOk)
|
|
ON_BN_CLICKED(IDOK, &CMFCApplication1Dlg::OnBnClickedOk)
|
|
ON_MESSAGE(WM_SHOWINFO, OnShowInfo)
|
|
ON_MESSAGE(WM_SHOWINFO, OnShowInfo)
|
|
ON_BN_CLICKED(IDCANCEL, &CMFCApplication1Dlg::OnBnClickedCancel)
|
|
ON_BN_CLICKED(IDCANCEL, &CMFCApplication1Dlg::OnBnClickedCancel)
|
|
|
|
+ ON_BN_CLICKED(IDC_BTN_TXT, &CMFCApplication1Dlg::OnBnClickedBtnTxt)
|
|
|
|
+ ON_BN_CLICKED(IDC_BTN_PDF, &CMFCApplication1Dlg::OnBnClickedBtnPdf)
|
|
END_MESSAGE_MAP()
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
@@ -271,3 +273,58 @@ void CMFCApplication1Dlg::OnBnClickedCancel()
|
|
SAFETY_EXIT_THREAD(_threadProcess, 100);
|
|
SAFETY_EXIT_THREAD(_threadProcess, 100);
|
|
CDialogEx::OnCancel();
|
|
CDialogEx::OnCancel();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void CMFCApplication1Dlg::SelectFolder(HWND hwnd, CString& lpszFolder)
|
|
|
|
+{
|
|
|
|
+ TCHAR szFolderPath[MAX_PATH];
|
|
|
|
+ szFolderPath[0] = 0;
|
|
|
|
+ BROWSEINFO sInfo;
|
|
|
|
+ ::ZeroMemory(&sInfo, sizeof(BROWSEINFO));
|
|
|
|
+ sInfo.pidlRoot = 0;
|
|
|
|
+ sInfo.lpszTitle = _T("请选择一个文件夹");
|
|
|
|
+ sInfo.ulFlags = BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE | BIF_EDITBOX;
|
|
|
|
+ sInfo.lpfn = NULL;
|
|
|
|
+ sInfo.hwndOwner = hwnd;
|
|
|
|
+ LPITEMIDLIST lpidlBrowse = ::SHBrowseForFolder(&sInfo);
|
|
|
|
+
|
|
|
|
+ if (lpidlBrowse != NULL) {
|
|
|
|
+ if (::SHGetPathFromIDList(lpidlBrowse, szFolderPath)) {
|
|
|
|
+ lpszFolder = szFolderPath;
|
|
|
|
+ lpszFolder.Replace('\\', '/');
|
|
|
|
+ }
|
|
|
|
+ ::CoTaskMemFree(lpidlBrowse);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void CMFCApplication1Dlg::OnBnClickedBtnTxt()
|
|
|
|
+{
|
|
|
|
+ CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_TXT);
|
|
|
|
+ if (!pEdit)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ CString strText;
|
|
|
|
+ SelectFolder(GetSafeHwnd(), strText);
|
|
|
|
+ if (strText.GetLength() == 0)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ pEdit->SetWindowText(strText);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void CMFCApplication1Dlg::OnBnClickedBtnPdf()
|
|
|
|
+{
|
|
|
|
+ CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_PDF);
|
|
|
|
+ if (!pEdit)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ CString strText;
|
|
|
|
+ SelectFolder(GetSafeHwnd(), strText);
|
|
|
|
+ if (strText.GetLength() == 0)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ pEdit->SetWindowText(strText);
|
|
|
|
+}
|