mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 22:49:23 +02:00
+ TResourceStream implemented
git-svn-id: trunk@1143 -
This commit is contained in:
parent
bb26084a0f
commit
527a01bc9d
@ -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;
|
||||
|
||||
{****************************************************************************}
|
||||
|
Loading…
Reference in New Issue
Block a user