怎样提取一个Exe文件的字符串资源?
我用下面的方法提取不到,只完成了一半的功能,请大家指点一下:
Function EnumResName(hModule: HMODULE; lpType, lpName: PChar;lParam: Longint):BOOL;stdcall;
procedure TForm1.btn1Click(Sender: TObject);
begin
EnumResourceNames(0, RT_STRING, @EnumResName, 0);
end;
Function EnumResName(hModule: HMODULE; lpType, lpName: PChar; lParam: Longint):BOOL; //回var
ResString: String;
hResource: HRSRC;
hglob: HGLOBAL;
Buffer: array [0..1023] of char;
Begin
result := True;
if lpType <> RT_STRING then exit;
//
hResource:=FindResource(hModule, lpName, RT_STRING);
//
hglob:=LoadResource(hModule, hResource);
SetString(ResString, Buffer,
LoadString(FindResourceHInstance(hModule), hglob, Buffer, SizeOf(Buffer)));
Form1.ValueListEditor1.Strings.Add(Format('%s=%s', [IntToStr(Integer(lpName)), ResString]))
//Form1.ValueListEditor1.Strings.Add(Format('%s=%s', [IntToStr(Integer(lpName)), IntToStr(Integer(hResource))]))
end;