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. FileDialog with the Favourites control on left

FileDialog with the Favourites control on left

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
6 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.
  • A Offline
    A Offline
    andrewtruckle
    wrote on last edited by
    #1

    Many programs are now showing a standard file selection dialogue box with the favourites control down the left hand side. How can one add this into a Visual C++ 6 application? Thanks. Andrew

    D 1 Reply Last reply
    0
    • A andrewtruckle

      Many programs are now showing a standard file selection dialogue box with the favourites control down the left hand side. How can one add this into a Visual C++ 6 application? Thanks. Andrew

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      You'll need to use GetOpenFileName() without a hook procedure. andrew/truckle@atkinsglobal.com wrote: Many programs are now showing a standard file selection dialogue box with the favourites control down the left hand side. Office does this (see the HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\Open Find\Places\StandardPlaces\Favorites registry value), but do you have another example?


      "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

      A 1 Reply Last reply
      0
      • D David Crow

        You'll need to use GetOpenFileName() without a hook procedure. andrew/truckle@atkinsglobal.com wrote: Many programs are now showing a standard file selection dialogue box with the favourites control down the left hand side. Office does this (see the HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\Open Find\Places\StandardPlaces\Favorites registry value), but do you have another example?


        "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

        A Offline
        A Offline
        andrewtruckle
        wrote on last edited by
        #3

        I have tried this code below, and it does indeed show a control on the left. But for some reason it still doesn't list "Favourites" as one of the choices. Also, it means I loose all the benfits that were in the CFileDialog class. It seems like I am trying to re-invent the wheel here.. :) Appreciate any advice. Andrew void CTestdlgDlg::OnButton1() { // TODO: Add your control notification handler code here OPENFILENAME ofn; TCHAR szFile[_MAX_PATH]=_T(""); ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = GetSafeHwnd(); ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0"; ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; GetOpenFileName(&ofn); }

        D 1 Reply Last reply
        0
        • A andrewtruckle

          I have tried this code below, and it does indeed show a control on the left. But for some reason it still doesn't list "Favourites" as one of the choices. Also, it means I loose all the benfits that were in the CFileDialog class. It seems like I am trying to re-invent the wheel here.. :) Appreciate any advice. Andrew void CTestdlgDlg::OnButton1() { // TODO: Add your control notification handler code here OPENFILENAME ofn; TCHAR szFile[_MAX_PATH]=_T(""); ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = GetSafeHwnd(); ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0"; ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; GetOpenFileName(&ofn); }

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          andrew.truckle@atkinsglobal.com wrote: I have tried this code below, and it does indeed show a control on the left. But for some reason it still doesn't list "Favourites" as one of the choices. Does the Places Bar normally contain the Favorites folder? A little research indicates it's not normally there, but it can be added with a registry tweak. In the following registry key, which doesn't exist by default: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\ComDlg32\PlacesBar you can specify up to five folders. Each folder is identified by an entry called Place0, Place1, and so forth, up to Place4. The value of these entries can be either a fully qualified path name or a CSIDL value that identifies a special folder independent of the particular machine. If you want to specify an absolute file system path, create a REG_SZ, or REG_EXPAND_SZ, entry. If you plan to use a CSIDL, then a REG_DWORD entry is mandatory. CSIDL values are defined in shlobj.h. Make sure you get the one that ships with the latest Platform SDK if you want the new IDs specific to Windows 2000. andrew.truckle@atkinsglobal.com wrote: Also, it means I loose all the benfits that were in the CFileDialog class. It seems like I am trying to re-invent the wheel here.. This is a "bug" with CFileDialog in that it uses a hook, thus preventing the Places Bar from showing up. It's a well documented issue.


          "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

          A 1 Reply Last reply
          0
          • D David Crow

            andrew.truckle@atkinsglobal.com wrote: I have tried this code below, and it does indeed show a control on the left. But for some reason it still doesn't list "Favourites" as one of the choices. Does the Places Bar normally contain the Favorites folder? A little research indicates it's not normally there, but it can be added with a registry tweak. In the following registry key, which doesn't exist by default: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\ComDlg32\PlacesBar you can specify up to five folders. Each folder is identified by an entry called Place0, Place1, and so forth, up to Place4. The value of these entries can be either a fully qualified path name or a CSIDL value that identifies a special folder independent of the particular machine. If you want to specify an absolute file system path, create a REG_SZ, or REG_EXPAND_SZ, entry. If you plan to use a CSIDL, then a REG_DWORD entry is mandatory. CSIDL values are defined in shlobj.h. Make sure you get the one that ships with the latest Platform SDK if you want the new IDs specific to Windows 2000. andrew.truckle@atkinsglobal.com wrote: Also, it means I loose all the benfits that were in the CFileDialog class. It seems like I am trying to re-invent the wheel here.. This is a "bug" with CFileDialog in that it uses a hook, thus preventing the Places Bar from showing up. It's a well documented issue.


            "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

            A Offline
            A Offline
            andrewtruckle
            wrote on last edited by
            #5

            It is a whole new concept in programming. I have not heard of a "Places Bar" or anything, let alone the bug fix. I have been trying to find how to do it on msdn and all that, to no avail. You are the first person to atleast offer a solution. I suppose i was surprised because the person who wanted this, has been using autocad 2004, and its file dialogue shows the vary same control on the left but with the bar... can you inform me of the "bug" articles? Andrew

            D 1 Reply Last reply
            0
            • A andrewtruckle

              It is a whole new concept in programming. I have not heard of a "Places Bar" or anything, let alone the bug fix. I have been trying to find how to do it on msdn and all that, to no avail. You are the first person to atleast offer a solution. I suppose i was surprised because the person who wanted this, has been using autocad 2004, and its file dialogue shows the vary same control on the left but with the bar... can you inform me of the "bug" articles? Andrew

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              andrew.truckle@atkinsglobal.com wrote: can you inform me of the "bug" articles? Yep. See here and here.


              "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

              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