English 中文(简体)
资源(res)档案中的文件
原标题:Loading text from resource (.res) file

我几天前就看到了这一理论,随后我也这样做。 由于我只有兴趣从资源档案中填满案文,我只使用了与我所需要的内容相关的文字。 可从研究中找到该守则:rel=“nofollow”>here。 注:我使用GetResourceAsPointerGetResourceAsString>。 我有:

  • created the resource file which contains one text file. The text file contains "test"
  • included {$R resource.res}

注:我用电灯从资源中载荷。

该方案能够无任何错误汇编,但当我点 but子把浮体装入电线时,便装上了体,而不是“试验”。 相反,我具有这样的广场和中国特性。

是否有任何人知道这个问题是什么? 是否有人经历过这种情况?

致谢

最佳回答

我使用以下两种例行做法,以便从EXE增加的资源中获取案文:一种是关于ANSI的插图,另一种是用于统法协会编码。 你的随机性可能是因为阅读比需要多。

Function GetResString (i, lang: integer): string;
var
 buffer: array [0..400] of char;
 ls: integer;

begin
 result:=   ;
 ls:= loadstring (hinstance, i + lang * 1000, buffer, sizeof (buffer));
 if ls <> 0 then result:= buffer
end;

function LoadResW (id, lang: integer): WideString;
const
 maxlength = 1024;

var
 ls: integer;

begin;
 setlength (result, maxlength);
 ls:= loadstringw (hinstance, lang * 1000 + id,
 pwidechar (result), length (result));
 if ls > 0
  then setlength (result, ls)
  else result:=   
end;
问题回答

在哪些方面,案文是你投入的资源? 如果ANSI将它作为Unicode()加以尝试。 GetResourceAsString from article use PChar.





相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...