Registriert seit: 27. Mai 2005
Ort: Baden
315 Beiträge
Delphi 2007 Enterprise
|
Re: [nonVCL] TEXT Ressource auslesen
1. Jan 2007, 16:51
Delphi-Quellcode:
function GetResourceData(lpName, lpType: PChar; var dwResSize: DWORD): Pointer;
var
hResInfo, hResData: HRSRC;
OldProtect: Cardinal;
lpBuffer: Pointer;
begin
Result := nil;
hResInfo := FindResource(hInstance, lpName, lpType);
if hResInfo <> 0 then
begin
dwResSize := SizeOfResource(hInstance, hResInfo);
if dwResSize <> 0 then
begin
hResData := LoadResource(hInstance, hResInfo);
if hResData <> 0 then
begin
lpBuffer := LockResource(hResData);
if lpBuffer <> nil then
begin
VirtualProtect(lpBuffer, dwResSize, PAGE_EXECUTE_READWRITE, OldProtect);
Result := lpBuffer;
UnlockResource(hResData);
end;
end;
end;
end;
end;
|
|
Zitat
|