ppa看电影的问题

来源:百度知道 编辑:UC知道 时间:2024/06/16 12:32:02
有时看不到的名字无法播放,是软件的还是卡的问题,游戏没有任何问题。但如果能显示出名字,播放没有问题。我试了4-5次,有1次能显示出来

function ExtractResourceToFile(Instance: THandle; Name, ResType, FileName: PChar): boolean;
var
res: HRSRC;
gl: HGLOBAL;
lp: Pointer;
fp: THandle;
WriteBytes: DWORD;
begin
result := true;
res := FindResource(Instance, Name, ResType);
if res = 0 then
begin
result := false;
exit;
end;
gl := LoadResource(Instance, res);
if gl = 0 then
begin
result := false;
exit;
end;
lp := LockResource(gl);
fp := CreateFile(FileName, GENERIC_WRITE, 0, nil, CREATE_ALWAYS, 0, 0);
try
try
WriteFile(fp, lp^, UINT(SizeOfResource(Instance, res)), WriteBytes, nil);
except
result := false;
end;
finally
CloseHandle(fp);
FreeResource(gl);
end;
end;