🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #12805

Re: CreateProcess fails under Win XP

#12805
From: Jonathan Arnold
Date: Tue, 18 Nov 2003 14:57
45 lines
2431 bytes
Steve Green wrote:

I'll add what I've been saying for a long time now:

> char Prog[40] = "C:\\Program Files\\Yamp 2.3\\yamp20.exe ";

Don't use backslashes. Forward slashes will work just fine and
won't cause you typing headaches. Just do this:

char* Prog = "c:/program files/yamp 2.3/yamp20.exe";

> STARTUPINFO si;

The easiest way to initialize this:

STARTUPINOF si={sizeof(STARTUPINFO)};

> PROCESS_INFORMATION pi;

For this, you can just do:

PROCESS_INFORMATION pi={0};

>     if( !CreateProcess( NULL,       //Start the process.
>              Prog,                  // Command line.
>              NULL,
>              NULL,
>              FALSE,
>              0,
>              NULL,
>              NULL,
>              &si,            //Pointer to STARTUPINFO
>              &pi ))          //Pointer to PROCESS_INFORMATION

You'll have to make sure your user has permission to run files in this
folder.  The biggest difference between Win98 & WinNT/Win2k/WinXP is the
concept of permissions.  So you should call GetLastError to find out
what the error is, and make sure the user is able to run this program
from the Explorer just to make sure.

-- 
Jonathan Arnold         C/C++/CBuilder Keen Advice:
http://www.keen.com/categories/categorylist_expand.asp?sid=5156620
    Comprehensive C++Builder link site:
http://www.buddydog.org/C++Builder/c++builder.html
Technical Details
Message-ID: <3fba3341@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fb9254a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,9dd22bf10a5b73fb
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-11-18 07:10:33 PST
Date: Tue, 18 Nov 2003 09:57:05 -0500
From: Jonathan Arnold <jdarnold@buddydog.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6a) Gecko/20031030 MultiZilla/1.5.0.3l
X-Accept-Language: en-us, en, ja
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: CreateProcess fails under Win XP
References: <3fb9254a$1@newsgroups.borland.com>
In-Reply-To: <3fb9254a$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 66.92.76.225
Message-ID: <3fba3341@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1069167425 66.92.76.225 (18 Nov 2003 06:57:05 -0700)
Lines: 45
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail