Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Dialog Template is replacing Standard Dialog

Dialog Template is replacing Standard Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 0 Offline
    0 Offline
    002comp
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • 0 002comp

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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

      0 1 Reply Last reply
      0
      • L Lost User

        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

        0 Offline
        0 Offline
        002comp
        wrote on last edited by
        #3

        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

        L 1 Reply Last reply
        0
        • 0 002comp

          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

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          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

          0 1 Reply Last reply
          0
          • L Lost User

            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

            0 Offline
            0 Offline
            002comp
            wrote on last edited by
            #5

            ok, I will try that way. Thanks. Regards Y

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups