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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. garbage using CFileDialog

garbage using CFileDialog

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 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.
  • L Offline
    L Offline
    Luis E Cuadrado
    wrote on last edited by
    #1

    Hello everybody: I have something weird happening when in a CFileDialog object that I create. From a menu, I choose a command that brings up a Open File dialog. The weird thing is happening when I click the File Type pull down where it says Executable Files (*.exe)|*.exe I able to see in the list the Executable Files (*.exe)|*.exe and under that some garbage. I just want that Open File dialog to have just 1 option (Executable Files (*.exe)|*.exe). This is the code that I have so far: //////////////////////////////////////////////////////// static char szFilter[] = "Executable Files (*.exe)|*.exe"; CFileDialog openDialog(TRUE,NULL, NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter); //Set the title of the dialog. CString sTitle; VERIFY(sTitle.LoadString(IDS_OPEN_WITH)); openDialog.m_ofn.lpstrTitle = sTitle; int nResult = openDialog.DoModal(); if(IDCANCEL==nResult) return; //////////////////////////////////////////////////////// Is there something that I need to do to correct this problem? I have a screenshot with the problem but I didn't saw anything in this forum that I can post images. Any answer is more than welcome. Best regards, Luis E. Luis E. Cuadrado :0)

    T 1 Reply Last reply
    0
    • L Luis E Cuadrado

      Hello everybody: I have something weird happening when in a CFileDialog object that I create. From a menu, I choose a command that brings up a Open File dialog. The weird thing is happening when I click the File Type pull down where it says Executable Files (*.exe)|*.exe I able to see in the list the Executable Files (*.exe)|*.exe and under that some garbage. I just want that Open File dialog to have just 1 option (Executable Files (*.exe)|*.exe). This is the code that I have so far: //////////////////////////////////////////////////////// static char szFilter[] = "Executable Files (*.exe)|*.exe"; CFileDialog openDialog(TRUE,NULL, NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter); //Set the title of the dialog. CString sTitle; VERIFY(sTitle.LoadString(IDS_OPEN_WITH)); openDialog.m_ofn.lpstrTitle = sTitle; int nResult = openDialog.DoModal(); if(IDCANCEL==nResult) return; //////////////////////////////////////////////////////// Is there something that I need to do to correct this problem? I have a screenshot with the problem but I didn't saw anything in this forum that I can post images. Any answer is more than welcome. Best regards, Luis E. Luis E. Cuadrado :0)

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      You forgot to append two '|' characters at the end of the string

      static char szFilter[] = "Executable Files (*.exe)|*.exe||";

      Tomasz Sowinski -- http://www.shooltz.com

      - It's for protection
      - Protection from what? Zee Germans?

      L 1 Reply Last reply
      0
      • T Tomasz Sowinski

        You forgot to append two '|' characters at the end of the string

        static char szFilter[] = "Executable Files (*.exe)|*.exe||";

        Tomasz Sowinski -- http://www.shooltz.com

        - It's for protection
        - Protection from what? Zee Germans?

        L Offline
        L Offline
        Luis E Cuadrado
        wrote on last edited by
        #3

        Ooppsss, I didn't notice that. I put the two "||" and it works. Thank you very much Tomasz for all your help. Have a nice day, Luis E. Cuadrado :0)

        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