Click here to Skip to main content
16,005,037 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questioncreateprocess Pin
dellthinker14-Aug-07 6:14
dellthinker14-Aug-07 6:14 
AnswerRe: createprocess Pin
led mike14-Aug-07 6:25
led mike14-Aug-07 6:25 
AnswerRe: createprocess Pin
Mark Salsbery14-Aug-07 6:32
Mark Salsbery14-Aug-07 6:32 
AnswerRe: createprocess Pin
Hamed Musavi14-Aug-07 6:36
Hamed Musavi14-Aug-07 6:36 
QuestionRe: createprocess Pin
David Crow14-Aug-07 7:45
David Crow14-Aug-07 7:45 
AnswerRe: createprocess Pin
dellthinker14-Aug-07 8:31
dellthinker14-Aug-07 8:31 
QuestionRe: createprocess Pin
David Crow14-Aug-07 8:46
David Crow14-Aug-07 8:46 
GeneralRe: createprocess Pin
Mark Salsbery14-Aug-07 9:49
Mark Salsbery14-Aug-07 9:49 
Is "notpad.exe" the app you want to run?

Also you need to pass something to those last two parameters, especially the
last one, since there's some handles returned that need to be freed.
    STARTUPINFO StartupInfo;
    memset(&StartupInfo, 0, sizeof(STARTUPINFO));
    StartupInfo.cb = sizeof(STARTUPINFO);  

    PROCESS_INFORMATION ProcessInformation;

    if (0 == ::CreateProcess(_T("C:\\Windows\\system32\\notepad.exe"), //  LPCTSTR lpApplicationName,
                            NULL,                    //  LPTSTR lpCommandLine,
                            NULL,                    //  LPSECURITY_ATTRIBUTES lpProcessAttributes,
                            NULL,                    //  LPSECURITY_ATTRIBUTES lpThreadAttributes,
                            FALSE,                   //  BOOL bInheritHandles,
                            NORMAL_PRIORITY_CLASS,   //  DWORD dwCreationFlags,
                            NULL,                    //  LPVOID lpEnvironment,
                            NULL,                    //  LPCTSTR lpCurrentDirectory,
                            &StartupInfo,            //  LPSTARTUPINFO lpStartupInfo,
                            &ProcessInformation      //  LPPROCESS_INFORMATION lpProcessInformation
                            ))
    {
        TRACE1("Failed because: %lu", ::GetLastError());
    }
    else
    {
        // Succeeded!

        ::CloseHandle(ProcessInformation.hProcess);
        ::CloseHandle(ProcessInformation.hThread);
    }


Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

AnswerRe: createprocess Pin
Michael Dunn14-Aug-07 9:04
sitebuilderMichael Dunn14-Aug-07 9:04 
QuestionMDI app doesn't close Pin
Alex Cutovoi14-Aug-07 6:01
Alex Cutovoi14-Aug-07 6:01 
AnswerRe: MDI app doesn't close Pin
Mark Salsbery14-Aug-07 6:42
Mark Salsbery14-Aug-07 6:42 
GeneralRe: MDI app doesn't close Pin
Alex Cutovoi14-Aug-07 6:57
Alex Cutovoi14-Aug-07 6:57 
GeneralRe: MDI app doesn't close Pin
Mark Salsbery14-Aug-07 7:14
Mark Salsbery14-Aug-07 7:14 
GeneralRe: MDI app doesn't close Pin
Alex Cutovoi14-Aug-07 7:47
Alex Cutovoi14-Aug-07 7:47 
GeneralRe: MDI app doesn't close Pin
Mark Salsbery14-Aug-07 8:13
Mark Salsbery14-Aug-07 8:13 
GeneralRe: MDI app doesn't close Pin
Alex Cutovoi14-Aug-07 8:33
Alex Cutovoi14-Aug-07 8:33 
GeneralRe: MDI app doesn't close Pin
Mark Salsbery14-Aug-07 8:43
Mark Salsbery14-Aug-07 8:43 
GeneralRe: MDI app doesn't close Pin
Alex Cutovoi14-Aug-07 9:56
Alex Cutovoi14-Aug-07 9:56 
GeneralRe: MDI app doesn't close Pin
Mark Salsbery14-Aug-07 10:05
Mark Salsbery14-Aug-07 10:05 
GeneralRe: MDI app doesn't close Pin
Alex Cutovoi14-Aug-07 10:54
Alex Cutovoi14-Aug-07 10:54 
GeneralRe: MDI app doesn't close Pin
Mark Salsbery14-Aug-07 11:12
Mark Salsbery14-Aug-07 11:12 
GeneralRe: MDI app doesn't close Pin
Alex Cutovoi15-Aug-07 3:36
Alex Cutovoi15-Aug-07 3:36 
GeneralRe: MDI app doesn't close Pin
Mark Salsbery15-Aug-07 5:12
Mark Salsbery15-Aug-07 5:12 
GeneralRe: MDI app doesn't close Pin
Alex Cutovoi15-Aug-07 6:47
Alex Cutovoi15-Aug-07 6:47 
Question_finite (CRT) [modified] Pin
Maxwell Chen14-Aug-07 5:15
Maxwell Chen14-Aug-07 5:15 

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.