+ TResourceStream implemented

git-svn-id: trunk@1143 -
This commit is contained in:
florian 2005-09-19 20:15:25 +00:00
parent bb26084a0f
commit 527a01bc9d

View File

@ -756,34 +756,43 @@ end;
{****************************************************************************} {****************************************************************************}
procedure TResourceStream.Initialize(Instance: THandle; Name, ResType: PChar); procedure TResourceStream.Initialize(Instance: THandle; Name, ResType: PChar);
begin
begin Res:=FindResource(Instance, Name, ResType);
end; if Res=0 then
raise EResNotFound.CreateFmt(SResNotFound,[Name]);
Handle:=LoadResource(Instance,Res);
if Handle=0 then
raise EResNotFound.CreateFmt(SResNotFound,[Name]);
SetPointer(LockResource(Handle),SizeOfResource(Instance,Res));
end;
constructor TResourceStream.Create(Instance: THandle; const ResName: string; ResType: PChar); constructor TResourceStream.Create(Instance: THandle; const ResName: string; ResType: PChar);
begin
begin inherited create;
end; Initialize(Instance,pchar(ResName),ResType);
end;
constructor TResourceStream.CreateFromID(Instance: THandle; ResID: Integer; ResType: PChar); constructor TResourceStream.CreateFromID(Instance: THandle; ResID: Integer; ResType: PChar);
begin
begin inherited create;
end; Initialize(Instance,pchar(ResID),ResType);
end;
destructor TResourceStream.Destroy; destructor TResourceStream.Destroy;
begin
begin UnlockResource(Handle);
end; FreeResource(Handle);
inherited destroy;
end;
function TResourceStream.Write(const Buffer; Count: Longint): Longint; function TResourceStream.Write(const Buffer; Count: Longint): Longint;
begin
begin raise EStreamError.Create(SCantWriteResourceStreamError);
Write:=0; end;
end;
{****************************************************************************} {****************************************************************************}
{* TOwnerStream *} {* TOwnerStream *}