MFC 中打开文件获得的文件路径

MFC 中打开文件获得的文件路径,第1张

CFileDialog dlg

if(IDCANCEL == dlg.DoModal()){

return

}

CString filePath = dlg.GetFilePathName()

首先从对话框的按钮处理槐迹函数中型明腊获得mainframe指针

cmainframe *pmain=(cmaimframe *)afxgetapp()->m_pmainwnd

然后获得相应视图指针cyourview *pview=(cyourview *)pmain->getactiveview()

最后获得视图对应的当前文档指针 cdocument * pcurrentdoc =(cframewnd *)m_pmainwnd->卜滑getactivedocument()


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/12252993.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-22
下一篇 2023-05-22

发表评论

登录后才能评论

评论列表(0条)

保存