home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
vp21beta.zip
/
OEXMPSRC.RAR
/
EA
/
TESTEA.PAS
< prev
Wrap
Pascal/Delphi Source File
|
2000-08-15
|
2KB
|
91 lines
{█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█}
{█ █}
{█ Virtual Pascal Examples Version 2.1 █}
{█ Extended Attributes Example █}
{█ ─────────────────────────────────────────────────█}
{█ Copyright (C) 1996-2000 vpascal.com █}
{█ Written May 1996 by Allan Mertner █}
{█ █}
{▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀}
{$Delphi+,T-,Use32-}
program TestEA;
uses
Os2EA, Os2Base, VPUtils, SysUtils;
procedure EATest( EAList: tEAList );
var
i : integer;
l : record
EAType : SmallWord;
Data : Longint;
end;
begin
with EAList do
try
Writeln( 'EAList created for ',FileName );
// Output list of EA's
Writeln( 'EA Count = ', Count, ' :' );
For i := 0 to Count-1 do
with Items[i] as tEA do
Writeln( '#',i:2,': ',GetString );
// Add a .Longname EA
With AddAscii( '.Longname', 'VP/2 Long Name' ) do
begin
Writeln( 'Added Ascii EA, .LONGNAME' );
Writeln( ' StringValue : ',StringValue );
end;
// Add another ASCII EA
With AddZAsciiZ( 'VP EA', 'Another EA written by VP/2' ) do
begin
Writeln( 'Added Ascii EA, VP EA' );
Writeln( ' StringValue : ',StringValue );
// Change the value
StringValue := 'Changed value';
end;
// Add a binary EA
l.eaType := eat_binary;
l.Data := $12345678;
AddEA( 'Longint EA', Sizeof(l), @l );
// Remove the "VP EA" again
RemoveNamedEA( 'VP EA' );
// Remove the first EA in the list
If Count > 0 then
RemoveEA( tEA( Items[0] ) );
// Update file's list of EAs. rc = 0 means success
Writeln( 'Write data; rc = ', WriteToFile );
finally
Destroy;
end;
end;
var
MyEA : tEAList;
begin
If ParamCount = 0 then
begin
Writeln( 'Please specify dir/filename as parameter' );
Halt(1);
end;
try
MyEA := tEAList.Create( ParamStr(1) );
EATest( MyEA );
except
on E:Exception do
Writeln( 'Exception : ',E.Message );
end;
end.