I used the Resource DLL Wizard in Delphi 2010 to generate resource only dll's for my program. When I look at them using Notepad++ it seems they are using ANSI encoding. Is there some setting I missed? It doesn't seem like a unicode program should store it's resources in ANSI especially for Asian languages.
I was looking specifically at the TABOUTBOX RT_RCDATA record. I tried to load it using the following code,
procedure LoadFromResFile(const FileName: string);
var
LibHandle: THandle;
ResourceLocation: HRSRC;
ResourceSize: dword;
ResourceHandle: THandle;
ResourcePointer: pointer;
ResStr: string;
begin
LibHandle := LoadLibraryEx(PWideChar(FileName), 0, LOAD_LIBRARY_AS_DATAFILE or LOAD_LIBRARY_AS_IMAGE_RESOURCE);
if LibHandle > 0 then
begin
ResourceLocation := FindResource(LibHandle, 'TABOUTBOX', RT_RCDATA);
ResourceSize := SizeofResource(LibHandle, ResourceLocation);
ResourceHandle := LoadResource(LibHandle, ResourceLocation);
ResourcePointer := LockResource(ResourceHandle);
if ResourcePointer <> nil then
begin
SetLength(ResStr, ResourceSize);
CopyMemory(@ResStr[1], ResourcePointer, ResourceSize);
FreeResource(ResourceHandle);
end;
FreeLibrary(LibHandle);
end else
begin
ResStr := SysErrorMessage(GetLastError);
ShowMessage(ResStr);
end;
I got garbage, but when I changed the type of ResStr to AnsiString, it showed up correctly. Opening the file in Notepad++ I can see that the dialog resources appear to be ansi, including the label captions.