Click here to Skip to main content
15,913,487 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Shell ? Pin
BaldwinMartin12-Dec-03 4:22
BaldwinMartin12-Dec-03 4:22 
AnswerRe: NO Shell Pin
Peter Molnar12-Dec-03 10:48
Peter Molnar12-Dec-03 10:48 
GeneralEXE Doubles in Size with every Resorce Compile Pin
Lucky the code machine12-Dec-03 0:47
Lucky the code machine12-Dec-03 0:47 
GeneralRe: EXE Doubles in Size with every Resorce Compile Pin
Alexander M.,12-Dec-03 5:27
Alexander M.,12-Dec-03 5:27 
GeneralRe: EXE Doubles in Size with every Resorce Compile Pin
Shay Harel12-Dec-03 6:11
Shay Harel12-Dec-03 6:11 
GeneralSolved it Pin
Lucky the code machine15-Dec-03 4:30
Lucky the code machine15-Dec-03 4:30 
GeneralRunning a exe from code Pin
Mortis12-Dec-03 0:26
Mortis12-Dec-03 0:26 
GeneralRe: Running a exe from code Pin
BaldwinMartin12-Dec-03 0:52
BaldwinMartin12-Dec-03 0:52 
OK Sure!

HANDLE YourAppName::StartProcessGettingProcessHandle(const TCHAR* pszCommandLine)
{
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof (SHELLEXECUTEINFO);
sei.lpVerb = NULL;
sei.lpFile = pszCommandLine;
sei.nShow = SW_SHOW;
sei.hInstApp = NULL;
sei.lpDirectory = NULL;
sei.fMask = SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS;
sei.lpParameters = NULL;
if (ShellExecuteEx (&sei) )
return sei.hProcess;
else
return NULL;

}

Call it with
m_hSpawnedProcess = pApp->StartProcessGettingProcessHandle(pApp->m_sProgramToRun);
// If the shell resides in the app.


In OnDestroy add
//Free up the process handle we have spawned if valid
if (m_hSpawnedProcess)
{
CloseHandle(m_hSpawnedProcess);
m_hSpawnedProcess = NULL;
}

//Let the base class do its thing
return CWinApp::ExitInstance();


Now monitor the handle





Best Wishes and Happy Holiday's,
ez_way
GeneralRe: Running a exe from code Pin
Mortis12-Dec-03 4:34
Mortis12-Dec-03 4:34 
GeneralRe: Running a exe from code Pin
BaldwinMartin12-Dec-03 4:40
BaldwinMartin12-Dec-03 4:40 
GeneralRe: Running a exe from code Pin
Mortis12-Dec-03 5:11
Mortis12-Dec-03 5:11 
GeneralRe: Running a exe from code Pin
Shay Harel12-Dec-03 6:17
Shay Harel12-Dec-03 6:17 
GeneralRe: Running a exe from code Pin
BaldwinMartin12-Dec-03 6:32
BaldwinMartin12-Dec-03 6:32 
GeneralRe: Running a exe from code Pin
Shay Harel12-Dec-03 6:48
Shay Harel12-Dec-03 6:48 
GeneralRe: Running a exe from code Pin
BaldwinMartin12-Dec-03 6:53
BaldwinMartin12-Dec-03 6:53 
GeneralRe: Running a exe from code Pin
BaldwinMartin12-Dec-03 9:04
BaldwinMartin12-Dec-03 9:04 
GeneralExecuting a program with arguments Pin
Nicolas Bonamy11-Dec-03 23:45
Nicolas Bonamy11-Dec-03 23:45 
GeneralRe: Executing a program with arguments Pin
David Crow12-Dec-03 2:48
David Crow12-Dec-03 2:48 
GeneralRe: Executing a program with arguments Pin
Nicolas Bonamy12-Dec-03 2:57
Nicolas Bonamy12-Dec-03 2:57 
GeneralRe: Executing a program with arguments Pin
David Crow12-Dec-03 3:16
David Crow12-Dec-03 3:16 
GeneralRe: Executing a program with arguments Pin
Nicolas Bonamy12-Dec-03 3:38
Nicolas Bonamy12-Dec-03 3:38 
GeneralRe: Executing a program with arguments Pin
l a u r e n12-Dec-03 20:40
l a u r e n12-Dec-03 20:40 
GeneralCComObject<> Problem Pin
Braulio Dez11-Dec-03 23:42
Braulio Dez11-Dec-03 23:42 
GeneralRe: CComObject<> Problem Pin
Peter Molnar12-Dec-03 10:16
Peter Molnar12-Dec-03 10:16 
GeneralRe: CComObject&lt;&gt; Problem Pin
Braulio Dez14-Dec-03 21:38
Braulio Dez14-Dec-03 21:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.