示例#1
0
void CSetupApp::DoStartApplication()
{
	try
	{
		MyShellExecute(NULL, _T("open"), GetDestExecutable(), NULL, NULL, SW_SHOWNORMAL);
	}
	catch (CException *pe)
	{
		pe->ReportError();
		pe->Delete();
	}
}
示例#2
0
void CDirstatDoc::OnCommandPromptHere()
{
	try
	{
		CItem *item= GetSelection();
		ASSERT(item != NULL);
		
		CString cmd= GetCOMSPEC();

		MyShellExecute(*AfxGetMainWnd(), _T("open"), cmd, NULL, item->GetFolderPath(), SW_SHOWNORMAL);
	}
	catch (CException *pe)
	{
		pe->ReportError();
		pe->Delete();
	}
}
示例#3
0
void CDirstatDoc::OnExplorerHere()
{
	try
	{
		const CItem *item= GetSelection();
		ASSERT(item != NULL);

		if (item->GetType() == IT_MYCOMPUTER)
		{
			SHELLEXECUTEINFO sei;
			ZeroMemory(&sei, sizeof(sei));
			sei.cbSize= sizeof(sei);
			sei.hwnd= *AfxGetMainWnd();
			sei.lpVerb= _T("explore");
			sei.nShow= SW_SHOWNORMAL;
			
			CCoTaskMem<LPITEMIDLIST> pidl;
			GetPidlOfMyComputer(&pidl);
		
			sei.lpIDList= pidl;
			sei.fMask|= SEE_MASK_IDLIST;

			ShellExecuteEx(&sei);
			// ShellExecuteEx seems to display its own Messagebox on error.
		}
		else
		{
			MyShellExecute(*AfxGetMainWnd(), _T("explore"), item->GetFolderPath(), NULL, NULL, SW_SHOWNORMAL);
		}
	}
	catch (CException *pe)
	{
		pe->ReportError();
		pe->Delete();
	}
}
示例#4
0
///////////////////////////////////////////////////////////////
//
// SharedUtil::ShellExecuteNonBlocking
//
//
//
///////////////////////////////////////////////////////////////
bool SharedUtil::ShellExecuteNonBlocking ( const SString& strAction, const SString& strFile, const SString& strParameters, const SString& strDirectory, int nShowCmd )
{
    return MyShellExecute ( false, strAction, strFile, strParameters, strDirectory );
}