<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: CreateProcess in full glory</title>
	<atom:link href="http://blog.delphi-jedi.net/2008/04/11/createprocess-in-full-glory/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.delphi-jedi.net/2008/04/11/createprocess-in-full-glory/</link>
	<description>Joint Endeavor of Delphi Innovators of Windows Programming</description>
	<pubDate>Wed, 08 Oct 2008 05:19:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=</generator>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: &#160; Did you know? #6&#160;by&#160;JEDI Windows API</title>
		<link>http://blog.delphi-jedi.net/2008/04/11/createprocess-in-full-glory/#comment-758</link>
		<dc:creator>&#160; Did you know? #6&#160;by&#160;JEDI Windows API</dc:creator>
		<pubDate>Thu, 15 May 2008 10:01:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=114#comment-758</guid>
		<description>[...] Find out more about CreateProcess in the post about &#8220;CreateProcess in full glory&#8220;. [...]</description>
		<content:encoded><![CDATA[<p>[...] Find out more about CreateProcess in the post about &#8220;CreateProcess in full glory&#8220;. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Wimmer</title>
		<link>http://blog.delphi-jedi.net/2008/04/11/createprocess-in-full-glory/#comment-113</link>
		<dc:creator>Christian Wimmer</dc:creator>
		<pubDate>Mon, 14 Apr 2008 08:36:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=114#comment-113</guid>
		<description>Thank you for the code.
BTW:
You should explicitly call GetEnvironmentStringsA, the Ansi version (which returns OEM characters). Furthermore use PAnsiChar instead of PChar, since PChar will become PWideChar in future releases of Delphi.</description>
		<content:encoded><![CDATA[<p>Thank you for the code.<br />
BTW:<br />
You should explicitly call GetEnvironmentStringsA, the Ansi version (which returns OEM characters). Furthermore use PAnsiChar instead of PChar, since PChar will become PWideChar in future releases of Delphi.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thaddy</title>
		<link>http://blog.delphi-jedi.net/2008/04/11/createprocess-in-full-glory/#comment-112</link>
		<dc:creator>Thaddy</dc:creator>
		<pubDate>Mon, 14 Apr 2008 08:19:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=114#comment-112</guid>
		<description>I use CreateProcess in a similar way to call different versions form dcc32.exe and fpc.exe in my homebrewed build tool.
Here's a q&#38;d code snippet that can even further simplify environment block handling

&lt;pre lang="Delphi"&gt;
unit NLDReadWriteEnvironmentBlock;
// Auteur Thaddy de Koning
// Freeware

interface
uses windows, classes, SysUtils;

const
  // Terminator gedefinieerd als typed const
  // (Zoadat het een memory reference heeft)
  NullChar:Char = #0;

type
  TEnvironmentBlockReader = class(Tstringlist)
  public
    constructor Create;
  end;

  TEnvironmentBlockWriter = class(TStringStream)
  private
     FClosed:Boolean;
    function GetBlockPtr: PAnsiChar;
  protected
     procedure Close;
  public
     procedure Add(const aValue:string);overload;
     procedure Add(const aToken,aValue:string);overload;
     Property Block:PAnsiChar read GetBlockPtr;
  end;

implementation
{ TEnvironmentBlockWriter }

// Is het blok gesloten?
// Zoja, ga een positie terug
// Schrijf de string
// Schrijf terminating #0
procedure TEnvironmentBlockWriter.Add(const aValue: string);
begin
  If FClosed then
  begin
    Seek(-1,soFromEnd);
    Fclosed :=False;
  end;
  WriteString(aValue);
  Write(NullChar,1);
end;

procedure TEnvironmentBlockWriter.Add(const aToken, aValue: string);
begin
  Add(aToken+'='+aValue);
end;

// Block afsluiten door een extra #0 te schrijven, als gespecificeerd
procedure TEnvironmentBlockWriter.Close;
begin
  if not FClosed then
  begin
    write(NullChar,1);
    FClosed := True;
  end;
end;

// Als we het block uitlezen nemen we aan dat het gesloten is!
function TEnvironmentBlockWriter.GetBlockPtr: PAnsiChar;
begin
  Close;
  Result := PChar(DataString);
end;

{ TEnvironmentBlockReader }

constructor TEnvironmentBlockReader.Create;
var
  FBlock,
  StrPtr:PChar;
begin
  inherited;
  FBlock :=GetEnvironmentStrings;
  if FBlock &lt;&gt;  nil then
  try
    StrPtr := FBlock;
    repeat
      Add(StrPtr);
      inc(StrPtr, Succ(StrLen(StrPtr)));
    until StrPtr^= #0;
  finally
    FreeEnvironmentStrings(Fblock);
  end;
end;

end.
&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>I use CreateProcess in a similar way to call different versions form dcc32.exe and fpc.exe in my homebrewed build tool.<br />
Here&#8217;s a q&amp;d code snippet that can even further simplify environment block handling</p>
<pre lang="Delphi">
unit NLDReadWriteEnvironmentBlock;
// Auteur Thaddy de Koning
// Freeware

interface
uses windows, classes, SysUtils;

const
  // Terminator gedefinieerd als typed const
  // (Zoadat het een memory reference heeft)
  NullChar:Char = #0;

type
  TEnvironmentBlockReader = class(Tstringlist)
  public
    constructor Create;
  end;

  TEnvironmentBlockWriter = class(TStringStream)
  private
     FClosed:Boolean;
    function GetBlockPtr: PAnsiChar;
  protected
     procedure Close;
  public
     procedure Add(const aValue:string);overload;
     procedure Add(const aToken,aValue:string);overload;
     Property Block:PAnsiChar read GetBlockPtr;
  end;

implementation
{ TEnvironmentBlockWriter }

// Is het blok gesloten?
// Zoja, ga een positie terug
// Schrijf de string
// Schrijf terminating #0
procedure TEnvironmentBlockWriter.Add(const aValue: string);
begin
  If FClosed then
  begin
    Seek(-1,soFromEnd);
    Fclosed :=False;
  end;
  WriteString(aValue);
  Write(NullChar,1);
end;

procedure TEnvironmentBlockWriter.Add(const aToken, aValue: string);
begin
  Add(aToken+'='+aValue);
end;

// Block afsluiten door een extra #0 te schrijven, als gespecificeerd
procedure TEnvironmentBlockWriter.Close;
begin
  if not FClosed then
  begin
    write(NullChar,1);
    FClosed := True;
  end;
end;

// Als we het block uitlezen nemen we aan dat het gesloten is!
function TEnvironmentBlockWriter.GetBlockPtr: PAnsiChar;
begin
  Close;
  Result := PChar(DataString);
end;

{ TEnvironmentBlockReader }

constructor TEnvironmentBlockReader.Create;
var
  FBlock,
  StrPtr:PChar;
begin
  inherited;
  FBlock :=GetEnvironmentStrings;
  if FBlock <>  nil then
  try
    StrPtr := FBlock;
    repeat
      Add(StrPtr);
      inc(StrPtr, Succ(StrLen(StrPtr)));
    until StrPtr^= #0;
  finally
    FreeEnvironmentStrings(Fblock);
  end;
end;

end.
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Wimmer</title>
		<link>http://blog.delphi-jedi.net/2008/04/11/createprocess-in-full-glory/#comment-91</link>
		<dc:creator>Christian Wimmer</dc:creator>
		<pubDate>Fri, 11 Apr 2008 17:32:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=114#comment-91</guid>
		<description>CreateProcess is very mighty. For a simple call, ShellExecute(Ex) is just fine. We use CreateProcess mainly, if  we want to control the new process accurately. In this case we have to do it right :)</description>
		<content:encoded><![CDATA[<p>CreateProcess is very mighty. For a simple call, ShellExecute(Ex) is just fine. We use CreateProcess mainly, if  we want to control the new process accurately. In this case we have to do it right <img src='http://blog.delphi-jedi.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Holger Flick</title>
		<link>http://blog.delphi-jedi.net/2008/04/11/createprocess-in-full-glory/#comment-90</link>
		<dc:creator>Holger Flick</dc:creator>
		<pubDate>Fri, 11 Apr 2008 13:53:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=114#comment-90</guid>
		<description>Seeing this really makes me love the Process class from .NET so much more :)</description>
		<content:encoded><![CDATA[<p>Seeing this really makes me love the Process class from .NET so much more <img src='http://blog.delphi-jedi.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
