Grupy dyskusyjne Google nie obsługują już nowych postów ani subskrypcji z Usenetu. Treści historyczne nadal będą dostępne.

CreateProcess() Help needed

623 wyświetlenia
Przejdź do pierwszej nieodczytanej wiadomości

Jason W. Taylor

nieprzeczytany,
2 paź 1997, 03:00:002.10.1997
do

I have some code that is supposed to launch an installshield self extracting
and installing .exe. I cannot get CreateProcess to launch it. And it always
returns 0 , as in "success". Even though nothing happens. (I'm in win95)

CreateProcess("C:\Program Files\Appname\Runme.exe",
NULL,
NULL,//95 ignores
NULL,//95 ignores
TRUE,
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&si,
&pi);

I created empty STARTUP_INFO and PROCESS_INFO structures, and I verified
that the runme.exe does exist at the path specified. I want to wait for this
.exe to complete execution before I go on, but I know how to do that ( i
think =] ) if I could only get it to actually launch.

Thanks a whole lot.

Jason W. Taylor

Sai Kayal

nieprzeczytany,
2 paź 1997, 03:00:002.10.1997
do

Just a thought.
In "C" or "C++" you need an escape character for "\".
So, the first parameter would look like "C:\\Program
Files\\Appname\\Runme.exe"

Jason W. Taylor <jta...@cerner.com> wrote in article
<#d2mIW4...@uppssnewspub05.moswest.msn.net>...


> I have some code that is supposed to launch an installshield self
extracting
> and installing .exe. I cannot get CreateProcess to launch it. And it
always
> returns 0 , as in "success". Even though nothing happens. (I'm in win95)
>
> CreateProcess("C:\Program Files\Appname\Runme.exe",
> NULL,

......

-Sai Kayal


Jason W. Taylor

nieprzeczytany,
3 paź 1997, 03:00:003.10.1997
do

Note that the filename and path I'm passing is actually a CString with
correct implementation of "\" characters. I didn't put that in the original
email for brevity.

Patrik Blomberg

nieprzeczytany,
3 paź 1997, 03:00:003.10.1997
do

> >> CreateProcess("C:\Program Files\Appname\Runme.exe",
[snip]
> It's giving me error number 37 "The parameter is incorrect". What
> parameter?? Is it talking about the parameters I'm passing to
> CreateProcess()? I'm confused.

Jason,

Since a backslash in a C string is used to indicate the beginning
of an escape sequence, you must use double bachslashes:


"C:\\Program Files\\Appname\\Runme.exe"

Cheers,
Patrik

------
If replying by email, remove the spam protection stuff ".---",
at the end of my return address.

Patrik Blomberg

nieprzeczytany,
3 paź 1997, 03:00:003.10.1997
do

> 1. The path should probably have embedded double-quotes around it.
> Construct the CString thus:
>
> CString strPath( "\"c:\\program files\\appname\\runme.exe\"");

Lance,

No, that won't work. It would cause error 123 (ERROR_INVALID_NAME).

Jason W. Taylor

nieprzeczytany,
3 paź 1997, 03:00:003.10.1997
do

Jeremy,

It's giving me error number 37 "The parameter is incorrect". What
parameter?? Is it talking about the parameters I'm passing to
CreateProcess()? I'm confused.

Jeremy Wise wrote in message <343525...@compuserve.com>...


>Jason W. Taylor wrote:
>>
>> I have some code that is supposed to launch an installshield self
extracting
>> and installing .exe. I cannot get CreateProcess to launch it. And it
always
>> returns 0 , as in "success". Even though nothing happens. (I'm in win95)
>>

>> CreateProcess("C:\Program Files\Appname\Runme.exe",

>> NULL,
>> NULL,//95 ignores
>> NULL,//95 ignores
>> TRUE,
>> NORMAL_PRIORITY_CLASS,
>> NULL,
>> NULL,
>> &si,
>> &pi);
>>
>> I created empty STARTUP_INFO and PROCESS_INFO structures, and I verified
>> that the runme.exe does exist at the path specified. I want to wait for
this
>> .exe to complete execution before I go on, but I know how to do that ( i
>> think =] ) if I could only get it to actually launch.
>>
>> Thanks a whole lot.
>>
>> Jason W. Taylor
>

>Jason-
>
>Seems to me that if CreateProcess is returning ZERO, then the call is
failing not
>succeeding. Generally what you want to do in that case is to call
GetLastError() to
>retrieve the error code for the error. There is a pretty full description
in the online
>help for CreateProcess for how to get the root error. I recently had a
problem with
>CreateProcess failing because it could not locate a DLL that the EXE
referenced as the
>DLL and EXE were in different locations and the DLL could not be found in
the standard
>places the system looks.
>
>Good luck, Jeremy Wise

Jeremy Wise

nieprzeczytany,
3 paź 1997, 03:00:003.10.1997
do

Katy Mulvey

nieprzeczytany,
3 paź 1997, 03:00:003.10.1997
do

In <#d2mIW4...@uppssnewspub05.moswest.msn.net>, Jason W. Taylor

<jta...@cerner.com> wrote:
>I have some code that is supposed to launch an installshield self extracting
>and installing .exe. I cannot get CreateProcess to launch it. And it always
>returns 0 , as in "success". Even though nothing happens. (I'm in win95)
>
>CreateProcess("C:\Program Files\Appname\Runme.exe",

As Sai Kayal said, this should be "C:\\Program Files\\Appname\\Runme.exe"

[snip]

>I created empty STARTUP_INFO and PROCESS_INFO structures,

You set si.cb = sizeof(STARTUP_INFO), I hope.

>I want to wait for this
>.exe to complete execution before I go on, but I know how to do that ( i
>think =] ) if I could only get it to actually launch.

You're may have a problem in any case because this is an InstallShield
installation. Your self-extracting EXE created with EXE Builder will launch
SETUP.EXE, a 16-bit program, which will then launch the 32-bit install
process, _INS0432._MP. You can wait for the self-extracter to finish, but
that doesn't mean that installation is actually complete. (This is true for
InstallShield 3.x, see InstallShield KB Q10100, Q10379 -- I'm not so sure
about InstallShield 5).

Katy

--
Katy Mulvey k...@ormec.com
Software Development Engineer
ORMEC Systems http://www.ormec.com


Patrik Blomberg

nieprzeczytany,
3 paź 1997, 03:00:003.10.1997
do

Oops! Sorry, Jason...I just saw your posting with your explanation
for the use of single backslashes in your description.

Do you initialize the STARTUPINFO struct correctly?

memset(&si, 0, sizeof(si));
si.cb = sizeof(si);

Lance Peterson

nieprzeczytany,
3 paź 1997, 03:00:003.10.1997
do

Maybe you've already tried it but here goes:

1. The path should probably have embedded double-quotes around it.
Construct the CString thus:

CString strPath( "\"c:\\program files\\appname\\runme.exe\"");

The docs say that CreateProcess should be able to get around the white
space in "program files" but you never can tell. It's worth a try if you
haven't already.

Lance
lance_hates_@_spam_worldnow.com
WorldNow Online Inc.


Jason W. Taylor <jta...@cerner.com> wrote in article
<#d2mIW4...@uppssnewspub05.moswest.msn.net>...


> I have some code that is supposed to launch an installshield self
extracting
> and installing .exe. I cannot get CreateProcess to launch it. And it
always
> returns 0 , as in "success". Even though nothing happens. (I'm in win95)
>
> CreateProcess("C:\Program Files\Appname\Runme.exe",

> NULL,
> NULL,//95 ignores
> NULL,//95 ignores
> TRUE,
> NORMAL_PRIORITY_CLASS,
> NULL,
> NULL,
> &si,
> &pi);
>
> I created empty STARTUP_INFO and PROCESS_INFO structures, and I verified

> that the runme.exe does exist at the path specified. I want to wait for


this
> .exe to complete execution before I go on, but I know how to do that ( i
> think =] ) if I could only get it to actually launch.
>

Bob Moore

nieprzeczytany,
3 paź 1997, 03:00:003.10.1997
do

On Thu, 2 Oct 1997 17:36:44 -0500, Jason W. Taylor wrote:

>I have some code that is supposed to launch an installshield self extracting
>and installing .exe. I cannot get CreateProcess to launch it. And it always
>returns 0 , as in "success". Even though nothing happens. (I'm in win95)

I suspect Patrik is right, it's your STARTUPINFO initialisation.
Here's how I normally do mine :

BOOL StartApp (const char * szAppString,
int nCmdShow)
{
STARTUPINFO sui ;
PROCESS_INFORMATION pi ;
BOOL bRet;

sui.cb = sizeof (STARTUPINFO);
GetStartupInfo (&sui);
sui.dwFlags = STARTF_USESHOWWINDOW ;
sui.wShowWindow = nCmdShow ; // see parameters

bRet = CreateProcess (NULL,
szAppString, // force path search
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&sui,
&pi);

Bob Moore [WinSDK MVP]

Daniel Doguet

nieprzeczytany,
7 paź 1997, 03:00:007.10.1997
do

Make sure you ZeroMemory (or memset) si, also in your example you did put \\ in the path
name

Daniel
http://www.activeplus.com

Jeremy Wise wrote:

> Jason W. Taylor wrote:
> >
> > I have some code that is supposed to launch an installshield self extracting
> > and installing .exe. I cannot get CreateProcess to launch it. And it always
> > returns 0 , as in "success". Even though nothing happens. (I'm in win95)
> >

> > CreateProcess("C:\Program Files\Appname\Runme.exe",
> > NULL,
> > NULL,//95 ignores
> > NULL,//95 ignores
> > TRUE,
> > NORMAL_PRIORITY_CLASS,
> > NULL,
> > NULL,
> > &si,
> > &pi);
> >
> > I created empty STARTUP_INFO and PROCESS_INFO structures, and I verified
> > that the runme.exe does exist at the path specified. I want to wait for this
> > .exe to complete execution before I go on, but I know how to do that ( i
> > think =] ) if I could only get it to actually launch.
> >
> > Thanks a whole lot.
> >
> > Jason W. Taylor
>

Nowe wiadomości: 0