Shell Windows Explorer to Specific Folder
Please help. I am trying to open Windows Explorer to specifically browse the Tasks folder from my program. Unfortunately Windows Explorer keeps opening to the "My Documents" folder.
Code:
// Locals
BOOL br=FALSE;
UINT cb=0;
TCHAR tszWinDir[MAX_PATH];
tszWinDir[0]=0;
STARTUPINFO siStartupInfo;
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
PROCESS_INFORMATION piProcessInfo;
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
CString strAppPath;
strAppPath = _T("C:\\Winnt"); // default
CString strTasksPath;
strTasksPath = _T("C:\\Winnt"); // default
// Shell Explorer to the task folder
cb = GetWindowsDirectory(tszWinDir, MAX_PATH);
if(cb>0)
{
strAppPath = tszWinDir;
strTasksPath = tszWinDir;
}
strAppPath += _T("\\explorer.exe");
strTasksPath += _T("\\Tasks");
siStartupInfo.cb = sizeof(siStartupInfo);
br = CreateProcess(strAppPath, // Application name
const_cast<TCHAR*>((const TCHAR*)strTasksPath), // Application arguments
0,
0,
FALSE,
CREATE_DEFAULT_ERROR_MODE,
0,
const_cast<TCHAR*>((const TCHAR*)strTasksPath), // Working directory
&siStartupInfo,
&piProcessInfo);