我想通過Visual Studio 2013中的MFC項目菜單中的默認打開按鈕來打開文件。我使用了瀏覽按鈕,並且使用了「OnBnClickedButton」函數來獲取打開的文件的地址,但現在沒有這樣的功能。 我該怎麼辦?MFC中的打開對話框C++
-1
A
回答
1
嚮導創建沒有打開(或保存)代碼的私有實現一個默認的MFC應用程序(SDI或MDI),它會調用默認框架代碼(請參閱ScottMcP-MVP答案)
通常,應該在應用程序中爲ID_FILE_OPEN添加一個處理程序來調用CFileDialog並自己處理該文件。
的CFileDialog是一個模式對話框
CFileDialog dlg(TRUE); // TRUE is to tell the dialog is used as an open CFileDialog.
if (dlg.DoModal() == IDOK)
{
CString fullPathName = dlg.GetPathName(); // get the full path name of the selected file.
//... add some of your own code to open the file and read it.
}
更好地利用
1
請參閱MSDN頁的CWinApp :: OnFileOpen
相關問題
- 1. 在std :: thread中打開MFC對話框
- 2. MFC打開文件夾對話框
- 3. 如何在C++ MFC中一次打開兩個對話框?
- 4. 在C++ mfc對話框中的幫助
- 5. 從C++打開的C#對話框
- 6. 從對話框打開的c#對話框關閉整個鏈
- 7. 打開對話框
- 8. C++負荷圖像對話框的MFC
- 9. 我的對話框沒有在MFC C++
- 10. MFC DoModal對話框
- 11. 用在對話框中MFC
- 12. C#打開文件對話框
- 13. C++ WinAPI保存和打開對話框
- 14. c#/ WPF openFileDialog對話框打開兩次
- 15. 如何從WPF應用程序打開MFC對話框?
- 16. C++ MFC:如何在創建第一個模式對話框後立即打開第二個對話框
- 17. 從qt中的對話框打開新對話框
- 18. 在JQuery Mobile的對話框中打開對話框
- 19. 無模式對話框中的MFC C++顯示模態對話框
- 20. 滾動到最後一行jQuery對話框中打開對話框打開
- 21. Android打開對話框
- 22. ngdialog - 打開子對話框
- 23. 打開/保存對話框
- 24. 打開目錄對話框
- 25. 對話框不打開android
- 26. jQuery UI對話框打開
- 27. 打開文件對話框
- 28. 打開文件對話框
- 29. OPENFILENAME打開對話框
- 30. 對話框打開後