Click here to Skip to main content
15,886,056 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Take a look at my new post, so that images could be shown.
Posted
Comments
HimanshuJoshi 14-May-11 13:46pm    
What? Don't create stupid questions that are not really questions. If you want to follow up on another question or answer, add a comment there.
Mr. Tomay 14-May-11 14:23pm    
I mean a question as a solution to my own post (so that images could be shown.), because when you create a new question and attach image links, that images wont show. So you have to do some tricks as I did ;)

CWinApp::OnFileOpen() will show a dialog like this image:


It is supposed to be like this one:


Any ideas !?

Help me please :'(
 
Share this answer
 
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).
 
Share this answer
 
Comments
Mr. Tomay 17-May-11 14:20pm    
These file Dialog resources are stored on a dll file named comdlg32.dll in the system directory. I've opened this file with an resource editor & I've seen that the two dialog templates (legacy and new one) are in that dll file. So it is independent of the app we create !?

If I am wrong, Is there a trick or a patch to do to VC6 to stay with VC6 and work with the new open file dialog ?
Albert Holguin 17-May-11 14:22pm    
I already answered... its dependent on the MFC version...
Albert Holguin 17-May-11 14:26pm    
with that said, I do believe you can make the new one look like the old one, but to make the old MFC CFileDialog look like the new CFileDialog... well, you'd have to essentially recreate what CFileDialog does... which is a wrapper around WinAPI functions in common dialog (comdlg32.dll)
Mr. Tomay 24-May-11 18:48pm    
I don't know how to do that.
Albert Holguin 24-May-11 23:48pm    
Ok... what part?
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;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900