+ 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,33 +756,42 @@ end;
{****************************************************************************}
procedure TResourceStream.Initialize(Instance: THandle; Name, ResType: PChar);
begin
Res:=FindResource(Instance, Name, ResType);
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);
begin
inherited create;
Initialize(Instance,pchar(ResName),ResType);
end;
constructor TResourceStream.CreateFromID(Instance: THandle; ResID: Integer; ResType: PChar);
begin
inherited create;
Initialize(Instance,pchar(ResID),ResType);
end;
destructor TResourceStream.Destroy;
begin
UnlockResource(Handle);
FreeResource(Handle);
inherited destroy;
end;
function TResourceStream.Write(const Buffer; Count: Longint): Longint;
begin
Write:=0;
raise EStreamError.Create(SCantWriteResourceStreamError);
end;
{****************************************************************************}