FileDialog with the Favourites control on left
-
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
-
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
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)
-
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)
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); }
-
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); }
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)
-
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)
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
-
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
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)