I have found a trick, a best solution making it possible, here it is:
CFileDialog dlgFile(TRUE, _T("png"), NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_EXPLORER, _T("PNG files (*.png)|*.png|All files (*)|*||"), this);
if (sizeof(OPENFILENAME) < 88)
{
OSVERSIONINFO osvi;
::ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
::GetVersionEx(&osvi);
if (osvi.dwPlatformId >= VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 && dlgFile.m_ofn.lStructSize < 88)
{
struct OPENFILENAMEEX
{
void* pvReserved;
DWORD dwReserved;
DWORD FlagsEx;
};
dlgFile.m_ofn.lStructSize += sizeof(OPENFILENAMEEX);
}
}
if (dlgFile.DoModal() == IDCANCEL)
return;