更新时间:2023-11-12 08:32:22
MFC使用大小为_MAX_PATH
的默认缓冲区,这就是为什么您看到这种行为的原因.查看dlgfile.cpp
以了解CFileDialog::CFileDialog
的实现,您将看到m_ofn.lpstrFile
和m_ofn.nMaxFile
被设置.
MFC uses a default buffer of size _MAX_PATH
and that's why you are seeing that behavior. Look at dlgfile.cpp
for the implementation of CFileDialog::CFileDialog
and you will see m_ofn.lpstrFile
and m_ofn.nMaxFile
being set.
如果需要,可以指定更大的缓冲区.在调用DoModal
之前,您可以访问CFileDialog::m_pOFN
成员以获取指向OPENFILENAME
将要使用的OPENFILENAME
的指针并直接对其进行更新,或者调用CFileDialog::GetOFN
以获得对该结构的引用并对其进行更新.
You can specify a larger buffer if you want to. Before calling DoModal
you can either access the CFileDialog::m_pOFN
member to get a pointer to the OPENFILENAME
that the CFileDialog
will use and update it directly or call CFileDialog::GetOFN
to get a reference to the structure and update that.
无论哪种方式,您都将找到帮助: http ://msdn.microsoft.com/zh-CN/library/ms646839(v = vs.80).aspx
Either way you will find this helpful: http://msdn.microsoft.com/en-US/library/ms646839(v=vs.80).aspx