473,387 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

CreateProcess

Is there a way to set the environment (specifically the PATH) for a
created process?

My current application was created using the correct path and I want
to "pass" this path to the newly created process which will be an
independent process of my current one.

Any ideas would be helpful.

I'd appreciate it if you could also email the reply to
es****@cerner.com in addition to posting it in this newsgroup if
possible.

Thanks
Elly Sokol
es****@cerner.com
Jul 22 '05 #1
13 8150
es****@jetbiz.com (Elly Sokol) writes:
Is there a way to set the environment (specifically the PATH) for a
created process?

My current application was created using the correct path and I want
to "pass" this path to the newly created process which will be an
independent process of my current one.

Any ideas would be helpful.

I'd appreciate it if you could also email the reply to
es****@cerner.com in addition to posting it in this newsgroup if
possible.

Thanks
Elly Sokol
es****@cerner.com


from MSDN/Platform SDK: DLLs, Processes, and Threads:

BOOL
CreateProcess(
LPCTSTR lpApplicationName
, LPTSTR lpCommandLine
, LPSECURITY_ATTRIBUTES lpProcessAttributes
, LPSECURITY_ATTRIBUTES lpThreadAttributes
, BOOL bInheritHandles
, DWORD dwCreationFlags
, LPVOID lpEnvironment
, LPCTSTR lpCurrentDirectory
, LPSTARTUPINFO lpStartupInfo
, LPPROCESS_INFORMATION lpProcessInformation
);

where lpEnvironment:
Pointer to an environment block for the new process. If this parameter is NULL,
the new process uses the environment of the calling process.
An environment block consists of a null-terminated block of null-terminated
strings. Each string is in the form:

name=value

Because the equal sign is used as a separator,
it must not be used in the name of an environment variable.

An environment block can contain either Unicode or ANSI characters.
If the environment block pointed to by lpEnvironment contains Unicode
characters, be sure that dwCreationFlags includes CREATE_UNICODE_ENVIRONMENT.

Note that an ANSI environment block is terminated by two zero bytes:
one for the last string, one more to terminate the block.
A Unicode environment block is terminated by four zero bytes:
two for the last string, two more to terminate the block.

--
Regards,
Misha Polatov
MetaCommunications Engineering
Jul 22 '05 #2
On Thu, 17 Jun 2004 16:51:57 -0500 in comp.lang.c++, Misha Polatov <mp******@meta-comm.com> wrote,
from MSDN/Platform SDK: DLLs, Processes, and Threads:


This comment is OFF TOPIC in comp.lang.c++. Please keep your answers to
standard portable C++ content and avoid proprietary API discussions.

See the welcome message posted twice per week in comp.lang.c++ or
available at http://www.slack.net/~shiva/welcome.txt

Jul 22 '05 #3
David Harmon wrote:
<snip>
See the welcome message posted twice per week in comp.lang.c++ or
available at http://www.slack.net/~shiva/welcome.txt


When /is/ it posted? I've never actually seen it except for going to the
site...

- Pete
Jul 22 '05 #4
Pete C. wrote:
When /is/ it posted? I've never actually seen it except for going to the
site...


It posts weekly.

http://groups.google.com/groups?selm...0uni-berlin.de

Internet Infrastruction Irony #85,346: USENET has less of a spam problem
than private e-mail. That's because the servers can collude to reject any
post they see too often. But this means newsgroups can't post their welcome
messages more than once a week.

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces
Jul 22 '05 #5
Elly Sokol wrote:
Is there a way to set the environment (specifically the PATH) for a
created process?


There probably is, but Standard C++ (the subject of thin NG) does not
even have "CreateProcess". Please refer to your compiler/os manual or
a newsgroup dedicated to it/them.

V
Jul 22 '05 #6
On Thu, 17 Jun 2004 22:10:45 GMT in comp.lang.c++, "Pete C." <x@x.x> wrote,
David Harmon wrote:
<snip>
See the welcome message posted twice per week in comp.lang.c++ or
available at http://www.slack.net/~shiva/welcome.txt


When /is/ it posted? I've never actually seen it except for going to the
site...


Today's post, June 17,
http://groups.google.com/gr*********...@uni-berlin.de

Twice a week slips in below BI=20

Jul 22 '05 #7
Phlip wrote:
Pete C. wrote:
When /is/ it posted? I've never actually seen it except for going to
the site...


It posts weekly.

http://groups.google.com/groups?selm...0uni-berlin.de

Internet Infrastruction Irony #85,346: USENET has less of a spam
problem than private e-mail. That's because the servers can collude
to reject any post they see too often. But this means newsgroups
can't post their welcome messages more than once a week.


Hmm, it's not on my server, news.west.earthlink.net. Strange that it would
reject the welcome message yet I see quite a bit of spam...

- Pete
Jul 22 '05 #8
On Thu, 17 Jun 2004 23:16:15 GMT in comp.lang.c++, "Pete C." <x@x.x>
wrote,
Hmm, it's not on my server, news.west.earthlink.net. Strange that it would
reject the welcome message yet I see quite a bit of spam...


That's odd, since it's on news.west... when I look there.
Have you killfiled it?

Jul 22 '05 #9
I've never seen the welcome message with my server news.v21.co.uk but it is
a poor server. Borland changed the cppbuilder language newsgroup to
borland.public.cppbuilder.language.cpp quite a long time ago. The other
Borland newsgroup must have changed name as well. The server name,
forums.borland.com is also needed to access them.

Fraser.
Jul 22 '05 #10
David Harmon wrote:
On Thu, 17 Jun 2004 23:16:15 GMT in comp.lang.c++, "Pete C." <x@x.x>
wrote,
Hmm, it's not on my server, news.west.earthlink.net. Strange that it
would reject the welcome message yet I see quite a bit of spam...


That's odd, since it's on news.west... when I look there.
Have you killfiled it?


Nope, my killfile is empty, and no filters. I tried Agent since you were
using that, but still didn't see it. Strange.
Perhaps since the EL servers require a login some sort of account settings
were changed.

- Pete
Jul 22 '05 #11
Victor Bazarov <v.********@comAcast.net> wrote in message news:<8k******************@dfw-read.news.verio.net>...
Elly Sokol wrote:
Is there a way to set the environment (specifically the PATH) for a
created process?


There probably is, but Standard C++ (the subject of thin NG) does not
even have "CreateProcess". Please refer to your compiler/os manual or
a newsgroup dedicated to it/them.

V


Sorry. I did not realize NG this was just for Standard C++. I
thought it would answer any C++ question.
Jul 22 '05 #12
Misha Polatov <mp******@meta-comm.com> wrote in message news:<ur***********@meta-comm.com>...
es****@jetbiz.com (Elly Sokol) writes:
Is there a way to set the environment (specifically the PATH) for a
created process?

My current application was created using the correct path and I want
to "pass" this path to the newly created process which will be an
independent process of my current one.

Any ideas would be helpful.

I'd appreciate it if you could also email the reply to
es****@cerner.com in addition to posting it in this newsgroup if
possible.

Thanks
Elly Sokol
es****@cerner.com


from MSDN/Platform SDK: DLLs, Processes, and Threads:

BOOL
CreateProcess(
LPCTSTR lpApplicationName
, LPTSTR lpCommandLine
, LPSECURITY_ATTRIBUTES lpProcessAttributes
, LPSECURITY_ATTRIBUTES lpThreadAttributes
, BOOL bInheritHandles
, DWORD dwCreationFlags
, LPVOID lpEnvironment
, LPCTSTR lpCurrentDirectory
, LPSTARTUPINFO lpStartupInfo
, LPPROCESS_INFORMATION lpProcessInformation
);

where lpEnvironment:
Pointer to an environment block for the new process. If this parameter is NULL,
the new process uses the environment of the calling process.
An environment block consists of a null-terminated block of null-terminated
strings. Each string is in the form:

name=value

Because the equal sign is used as a separator,
it must not be used in the name of an environment variable.

An environment block can contain either Unicode or ANSI characters.
If the environment block pointed to by lpEnvironment contains Unicode
characters, be sure that dwCreationFlags includes CREATE_UNICODE_ENVIRONMENT.

Note that an ANSI environment block is terminated by two zero bytes:
one for the last string, one more to terminate the block.
A Unicode environment block is terminated by four zero bytes:
two for the last string, two more to terminate the block.


Thanks for the info. It is very helpful.

Elly
Jul 22 '05 #13
On Fri, 18 Jun 2004 12:44:50 GMT, "Pete C." <x@x.x> wrote:
David Harmon wrote:
On Thu, 17 Jun 2004 23:16:15 GMT in comp.lang.c++, "Pete C." <x@x.x>
wrote,
Hmm, it's not on my server, news.west.earthlink.net. Strange that it
would reject the welcome message yet I see quite a bit of spam...


That's odd, since it's on news.west... when I look there.
Have you killfiled it?


Nope, my killfile is empty, and no filters. I tried Agent since you were
using that, but still didn't see it. Strange.
Perhaps since the EL servers require a login some sort of account settings
were changed.

- Pete


You've definitely got a problem somewhere. I see it posted on
news.west.earthlink.net twice a week. I just checked and it is on
news.east.earthlink.net also.

The latest two were posted 6/17/2004 and 6/13/2004.

As for why you can't see them I haven't a clue, but they are there,
and have been consistently, twice per week.
Jul 22 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Achim Domma | last post by:
Hi, I try to start a process on windows using win32process.CreateProcess and want to to redirect the output. I set the STARTF_USESTDHANDLES flag in the STARTUPINFO structure. But I can not...
6
by: david.humpherys | last post by:
os:winnt python2.3.2 I have a exe that dumps info to the command line. I want to run this process and capture the stdout into a file. I think i'm close... any help appreciated. dh...
0
by: ByteSize | last post by:
Would be grateful of advice please. I have code in VB6 working as follows: lngReply = CreateProcess(sNull, txtStart, ByVal 0&, ByVal 0&, 1&, _ NORMAL_PRIORITY_CLASS, ByVal 0&, sNull, sInfo,...
1
by: DOT NET JIM | last post by:
in VB6 the api declares the createprocess lbEnv var as any. When converted to ..NET is change the type any to Object. The problem is, what kind of object. I can not get the env variables set when...
3
by: kal | last post by:
Hi, I am trying to write an application that will launch a second application using CreateProcess... SECURITY_ATTRIBUTES sa; STARTUPINFO si; PROCESS_INFORMATION pi; ::ZeroMemory( &sa,...
5
by: Stefano Camaiani | last post by:
Hello, please someone have the working code on how to call the CreateProcess API in Vb.Net? I need to call the CreateProcess API directly and i should not use the Vb.Net Process functions like dim...
2
by: Paul Schenk | last post by:
Hi All :) Would be grateful of advice please. I have code in VB6 working as follows: lngReply = CreateProcess(sNull, txtStart, ByVal 0&, ByVal 0&, 1&, _ NORMAL_PRIORITY_CLASS, ByVal 0&,...
1
by: itmanager | last post by:
I am trying to create a process at a particular set of coordinates (for example 1,1) but the CreateProcess api seemingly ignores the settings in the dwX and dwY properties of the STARTUPINFO...
1
by: Jai | last post by:
Please provide sample code for using Createprocess in VB.NET. The code I am using is given below. But I get "Error 91: Object referrence not set to an instance of the object" at CreateProcess...
6
by: ss.teo | last post by:
I want to fork a new process and my executable binary is stored inside somewhere. Is there any possible way to fork a process using CreateProcess API without writing to the disk first? Like let's...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.