harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Khaschansky" <oleg.v.khaschan...@gmail.com>
Subject Re: [OT] win32 guru help needed
Date Mon, 04 Dec 2006 15:18:31 GMT
Use this:

int main(int argc, char **argv, char **envp)
{
       PROCESS_INFORMATION procInfo;
       procInfo.dwProcessId = 0;
       procInfo.dwThreadId = 0;
       procInfo.hProcess = 0;
       procInfo.hThread = 0;

       STARTUPINFO sInfo;
       sInfo.cb = sizeof(STARTUPINFO);
       sInfo.lpReserved = NULL;
       sInfo.lpDesktop = NULL;
       sInfo.lpTitle = NULL;
       sInfo.dwFlags = 0;
       sInfo.cbReserved2 = 0;
       sInfo.lpReserved2 = NULL;

       CreateProcess("cmd.exe",NULL, NULL, NULL,

               FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &sInfo,&procInfo);


}

On 12/4/06, Geir Magnusson Jr. <geir@pobox.com> wrote:
> I'm embarrassed to ask this, but it's been about 4 years since I did
> windows programming in anger.  Why does the following simple console
> win32 program *crash* :
>
> #include <windows.h>
>
> int main(int argc, char **argv, char **envp)
> {
>         PROCESS_INFORMATION procInfo;
>         procInfo.dwProcessId = 0;
>                 procInfo.dwThreadId = 0;
>          procInfo.hProcess = 0;
>          procInfo.hThread = 0;
>
>         CreateProcess("cmd.exe","", NULL, NULL,
>
>                 FALSE, 0, NULL, NULL, NULL,&procInfo);
> }
>
>
> I can understand why CreateProcess might *fail*, but I don't grok why it
> would crash...
>
> geir
>
>

Mime
View raw message