Dialog Template is replacing Standard Dialog
-
Hello Friends I am creating a MfC Dialog based application using vs2010 in XP. I am adding some controls to dialog by using Template. Now,When I am opening that application in Win7, the default XP style with additional control is coming fine but it replacing Win7 Dialog standard controls like Search feature. And If i Pass the last parameter to CFiledialog [bVistaStyle] to TRUE then only Win7 style dialog is appearing but not additional controls tht i added using template. I want dialog should appear like Xp style with template and and with win7 standard controls too. Any Ideas ? Regards Y
-
Hello Friends I am creating a MfC Dialog based application using vs2010 in XP. I am adding some controls to dialog by using Template. Now,When I am opening that application in Win7, the default XP style with additional control is coming fine but it replacing Win7 Dialog standard controls like Search feature. And If i Pass the last parameter to CFiledialog [bVistaStyle] to TRUE then only Win7 style dialog is appearing but not additional controls tht i added using template. I want dialog should appear like Xp style with template and and with win7 standard controls too. Any Ideas ? Regards Y
-
yogeshs wrote:
Any Ideas ?
Yes, but unlessyou show us the code that is not working it is unlikely that we can guess what is going wrong.
Use the best guess
Here is the Class that i Sublasses from CFileDialog with setting last parameter in CFileDialog bVistaStyle to FALSE.
FileDialogTemplate::FileDialogTemplate(const LPCSTR caption, BOOL bOpenFile,
LPCSTR lpszDefExt, LPCSTR lpszFileName, DWORD dwFlags, LPCSTR lpszFilter,
CWnd* pParentWnd, int idx, BOOL pain, BOOL sav7, char* DefDir, int typ,
BOOL ivrit, int ver, int nVersion, BOOL multy, LPFNDLL_SWITCHREAD pSwitchRead)
: CFileDialog(bOpenFile, bOpenFile ? lpszDefExt : NULL,
alignFileName(lpszFileName),
(typ == sf_spec) ?
((dwFlags != 0) ? dwFlags : OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT) :
(typ == sf_bmp || typ == sf_fpf) ?
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |
OFN_NOCHANGEDIR | OFN_ENABLETEMPLATE | OFN_EXPLORER) :
(typ == sf_dsn_dir) ?
(OFN_HIDEREADONLY | OFN_NOVALIDATE | OFN_ENABLETEMPLATE | OFN_EXPLORER) :
(typ == sf_dsn || typ == sf_dsp || typ == sf_rul) ?
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |
OFN_ENABLETEMPLATE | OFN_EXPLORER) :
(typ == sf_log) ?
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER) :
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER),
lpszFilter, pParentWnd,0UL,FALSE)
{
m_pSwitchRead = pSwitchRead;m\_DefExt = (bOpenFile || lpszDefExt == NULL) ? "" : lpszDefExt; m\_Multy = multy && bOpenFile; HMODULE hResourceOld = ::AfxGetResourceHandle(); ::AfxSetResourceHandle(SHARED\_RES\_MODULE); ivrit\_eng = ivrit; m\_ver = (typ == sf\_dsn\_dir || typ == sf\_dsn || typ == sf\_dsp || typ == sf\_rul) ? ver : 0; rul\_num = rul\_size\_num = 0; bOpenFileDialog = bOpenFile; sv7 = FALSE;
// (!bOpenFile && sav7 && (typ == sf_dsn_dir || typ == sf_dsn || typ == sf_dsp || typ == sf_rul);
paint = (pain &&
(typ == sf_dsn_dir || typ == sf_dsn || typ == sf_dsp || typ == sf_bmp ||
typ == sf_rul || typ == sf_fpf || typ == sf_spec));
type = typ;
save7 = 0;
m_pImage = NULL;
m_Bitmap = NULL;
m_IsModulateFile = FALSE;
m_SizeSel = 0;
m_ofn.hInstance = SHARED_RES_MODULE;
title = new char[_MAX_PATH];
title[0] = '\0';
m_ofn.lpstrFileTitle = title;
m_ofn.nMaxFileTitle = _MAX_PATH;
int buf_size = 65536;
file_buf = new char[buf_size];
file_buf[0] = '\0';
file_buf[buf_size-1] = '\0';
if ( lpszFileName != NULL )
lstrcpyn(file_buf, lpszFileName, buf_size-1);
m_ofn.lpstrFile = file_buf;
m_ofn.nMaxFile = buf_size - 1;
if ( caption != NULL ) {
m_ofn.lpstrTitle = caption;
} else
m_o -
Here is the Class that i Sublasses from CFileDialog with setting last parameter in CFileDialog bVistaStyle to FALSE.
FileDialogTemplate::FileDialogTemplate(const LPCSTR caption, BOOL bOpenFile,
LPCSTR lpszDefExt, LPCSTR lpszFileName, DWORD dwFlags, LPCSTR lpszFilter,
CWnd* pParentWnd, int idx, BOOL pain, BOOL sav7, char* DefDir, int typ,
BOOL ivrit, int ver, int nVersion, BOOL multy, LPFNDLL_SWITCHREAD pSwitchRead)
: CFileDialog(bOpenFile, bOpenFile ? lpszDefExt : NULL,
alignFileName(lpszFileName),
(typ == sf_spec) ?
((dwFlags != 0) ? dwFlags : OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT) :
(typ == sf_bmp || typ == sf_fpf) ?
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |
OFN_NOCHANGEDIR | OFN_ENABLETEMPLATE | OFN_EXPLORER) :
(typ == sf_dsn_dir) ?
(OFN_HIDEREADONLY | OFN_NOVALIDATE | OFN_ENABLETEMPLATE | OFN_EXPLORER) :
(typ == sf_dsn || typ == sf_dsp || typ == sf_rul) ?
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |
OFN_ENABLETEMPLATE | OFN_EXPLORER) :
(typ == sf_log) ?
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER) :
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER),
lpszFilter, pParentWnd,0UL,FALSE)
{
m_pSwitchRead = pSwitchRead;m\_DefExt = (bOpenFile || lpszDefExt == NULL) ? "" : lpszDefExt; m\_Multy = multy && bOpenFile; HMODULE hResourceOld = ::AfxGetResourceHandle(); ::AfxSetResourceHandle(SHARED\_RES\_MODULE); ivrit\_eng = ivrit; m\_ver = (typ == sf\_dsn\_dir || typ == sf\_dsn || typ == sf\_dsp || typ == sf\_rul) ? ver : 0; rul\_num = rul\_size\_num = 0; bOpenFileDialog = bOpenFile; sv7 = FALSE;
// (!bOpenFile && sav7 && (typ == sf_dsn_dir || typ == sf_dsn || typ == sf_dsp || typ == sf_rul);
paint = (pain &&
(typ == sf_dsn_dir || typ == sf_dsn || typ == sf_dsp || typ == sf_bmp ||
typ == sf_rul || typ == sf_fpf || typ == sf_spec));
type = typ;
save7 = 0;
m_pImage = NULL;
m_Bitmap = NULL;
m_IsModulateFile = FALSE;
m_SizeSel = 0;
m_ofn.hInstance = SHARED_RES_MODULE;
title = new char[_MAX_PATH];
title[0] = '\0';
m_ofn.lpstrFileTitle = title;
m_ofn.nMaxFileTitle = _MAX_PATH;
int buf_size = 65536;
file_buf = new char[buf_size];
file_buf[0] = '\0';
file_buf[buf_size-1] = '\0';
if ( lpszFileName != NULL )
lstrcpyn(file_buf, lpszFileName, buf_size-1);
m_ofn.lpstrFile = file_buf;
m_ofn.nMaxFile = buf_size - 1;
if ( caption != NULL ) {
m_ofn.lpstrTitle = caption;
} else
m_o -
Sorry, but I cannot make head or tail of the above code. I would suggest you do some testing with basic
CFileDialog
templates to try and see what differences are happening.Use the best guess