Click to See Complete Forum and Search --> : Re: CFileDialog - beginning in non-filesystem location


Joseph
March 29th, 1999, 01:31 PM
Michael,

To start in the Desktop directory, call ::SHGetSpecialFolderPath to get the desktop folder and set it as the initial

folder in the file dialog. Like this:

TCHAR szPath[MAX_PATH];

HRESULT hRes = ::SHGetSpecialFolderPath(NULL, szPath, CSIDL_DESKTOPDIRECTORY, FALSE);

if (SUCCEEDED(hRes))

{

CFileDialog dlg(TRUE);

dlg.m_ofn.lpstrInitialDir = szPath;

dlg.DoModal();

}

This should work. I haven't tryed it yet. It's probably possible to use SHGetSpecialFolderPath to get the Network

Neighborhood directory too.


Joseph

Mike F.
March 29th, 1999, 01:37 PM
That suggestion works perfectly for items like the Desktop that actually have a physical representation in the file system (i.e. C:\windows\profiles\mine\desktop)


But Network Neighborhood (Not NetHood) does not have such a representation. (it is like the Control Panel).


This is where my difficulty lies.


Any further suggestions would be appreciated.