Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2005

Tip: Looking for answers? Try searching our database.

Default GetOpenFileName to "My Computer"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mnlarsen - 27 May 2005 17:45 GMT
How do I set the default location to "My Computer" when using the
GetOpenFileName call?

I have tried the following but CSIDL_DRIVES doesn't appear to work.  Any
ideas?
   
 WCHAR szFile[260] = _T("text.txt");
 WCHAR szPath[MAX_PATH] = _T("");
 LPITEMIDLIST pidl;
 HRESULT hr = SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &pidl);
 if(SUCCEEDED(hr))
   SHGetPathFromIDList(pidl, szPath);

 ZeroMemory(&ofn, sizeof(OPENFILENAME));
 ofn.lStructSize = sizeof(OPENFILENAME);
 ofn.hwndOwner = hwnd;
 ofn.lpstrFile = szFile;
 ofn.nMaxFile = sizeof(szFile);
 ofn.lpstrFilter = _T("All\0*.*\0Text\0*.txt\0");
 ofn.nFilterIndex = 1;
 ofn.lpstrFileTitle = NULL;
 ofn.nMaxFileTitle = 0;
 ofn.lpstrInitialDir = szPath;
 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

 if(GetOpenFileName(&ofn)==TRUE)  // File dialog Open selected
 {}
Signature

mnlarsen

ismailp - 27 May 2005 19:32 GMT
as far as I know, it's not possible. Windows stores last opened files
under registry.

Ismail

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.