That is a good idea. Let me try executing notepad and see what happens. My
code is based on dynamic strings loaded from an INI file located in the
Windows directory. I have tested it under the Explorer shell and it all
works... The code looks like this:
// CDlgFBI message handlers
void CDlgFBI::StartProcess(CString strPath, CString strWork)
{
// get the default startup information
STARTUPINFO startUp = { 0 };
startUp.cb = sizeof (STARTUPINFO);
GetStartupInfo(&startUp);
// create the process
PROCESS_INFORMATION pi = { 0 };
BOOL fRet = CreateProcess(strPath, NULL, NULL, NULL, TRUE, 0, NULL,
strWork, &startUp, &pi);
ASSERT(fRet);
}
void CDlgFBI::OnBnClickedInstallChipset()
{
// get executable and working directory from the INI
CString strWorkingDir = theApp.GetProfileString(_T("Install"),
_T("WorkingDir"));
CString strPath = theApp.GetProfileString(_T("Install"), _T("Chipset"));
StartProcess(strPath, strWorkingDir);
}
The INI entries are:
[Install]
WorkingDir="C:\NVIDIA"
Chipset="C:\NVIDIA\Chipset\Setup.exe"