CWinApp :: OnFileOpen()(新的CFileDialog模板) [英] CWinApp::OnFileOpen() (New CFileDialog Template)

查看:93
本文介绍了CWinApp :: OnFileOpen()(新的CFileDialog模板)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看看我的新帖子,以便显示图像.

推荐答案

CWinApp::OnFileOpen() 将显示这样的对话框:


应该是这样的:


有任何想法!?

请帮助我:''(
CWinApp::OnFileOpen() will show a dialog like this image:


It is supposed to be like this one:


Any ideas !?

Help me please :''(


CWinApp::OnFileOpen()只是调用CFileDialog(),如果它看起来不同,可能是因为您使用的是旧版本的MFC(因为仍在Studio 6上进行开发,我只能假设您仍在使用MFC的原始安装版本.如果希望对话框以其他方式显示,则需要升级MFC版本或升级项目到更新版本的studio(新的MFC版本随附).
CWinApp::OnFileOpen() just calls CFileDialog(), if it looks different, its probably because you''re using an old version of MFC (since you''re still developing on studio 6, I can only assume you''re still using the original installed version of MFC). If you''d like the dialog to look the other way, you need to upgrade your MFC version or upgrade your project to a newer version of studio (which comes with the newer MFC versions).


我发现了一个窍门,一个最佳的解决方案使之成为可能,这里是:

I have found a trick, a best solution making it possible, here it is:

// TODO: Add your control notification handler code here
CFileDialog dlgFile(TRUE, _T("png"), NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_EXPLORER, _T("PNG files (*.png)|*.png|All files (*)|*||"), this);

// Check to see if this is Windows 2000 or later, if so use the
// Windows 2000 version of OPENFILENAME.
if (sizeof(OPENFILENAME) < 88)
{
	OSVERSIONINFO osvi;
	// zero memory and set struct size.
	::ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
	
	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
	
	// get the Windows OS version information.
	::GetVersionEx(&osvi);
	
	if (osvi.dwPlatformId >= VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 && dlgFile.m_ofn.lStructSize < 88)
	{
		// Windows 2000 version of OPENFILENAME has three extra members,
		// this was copied from newer version of commdlg.h...
		struct OPENFILENAMEEX
		{
			void* pvReserved; // 4 bytes
			DWORD dwReserved; // 4 bytes
			DWORD FlagsEx;    // 4 bytes
		};
		
		dlgFile.m_ofn.lStructSize += sizeof(OPENFILENAMEEX); // should equal an additional 12 bytes;
	}
}

if (dlgFile.DoModal() == IDCANCEL)
	return;


这篇关于CWinApp :: OnFileOpen()(新的CFileDialog模板)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆