-



CGI


, CGI , HTML ( ). ? : DOS 'CONTENT LENGTH' ( , ). , . TBDosEnvironment DOS:

unit DrBobDOS;

interface

uses

SysUtils, WinTypes, WinProcs, Classes;

type

TBDosEnvironment = class(TComponent)

public

{ Public class declarations (override) }

constructor

Create(AOwner: TComponent); override;

destructor

Destroy; override;

private

{ Private field declarations }

FDosEnvList: TStringList;

procedure

DoNothing(const Value: TStringList);

protected

{ Protected method declarations }

Dummy: Word;

function

GetDosEnvCount: Word;

public

{ Public interface declarations }

function

GetDosEnvStr(const Name: String): String;

{ This function is a modified version of the GetEnvVar function that appears in the WinDos unit that comes with Delphi. This function's interface uses Pascal strings instead of null-terminated strings.

}

published

{ Published design declarations }

property

DosEnvCount: Word read

GetDosEnvCount write Dummy;

property

DosEnvList: TStringList read

FDosEnvList write DoNothing;

end;

implementation

constructor

TBDosEnvironment.Create(AOwner: TComponent);

var

P: PChar;

begin

inherited

Create(AOwner);

FDosEnvList := TStringList.Create;

{$IFDEF WIN32}

P := GetEnvironmentStrings;

{$ELSE}

P := GetDosEnvironment;

{$ENDIF}

while

P^ <> #0 do

begin

FDosEnvList.Add(StrPas(P));