可以自己编译一个frcc.exe,替换Res目录下的,然后再recompile即可。 delphi 2010(update5)测试界面都正常。
用delphi 2010 XE2建立一个console工程,名称为frcc,代码如下:
program frcc; {$APPTYPE CONSOLE} uses SysUtils, Classes, StrUtils; var xml: string; list: TStringList; i: Integer; fileName : string; lineWidth: integer; line: string; begin try if ParamCount < 1 then begin Writeln('no input'); Exit; end; xml := ParamStr(1); fileName := ExtractFileName(xml); fileName := Copy(fileName, 1, Length(fileName) - 4); //delete ext .xml list := TStringList.Create(); list.LoadFromFile(xml, TEncoding.UTF8); xml := list.Text; list.Clear; list.Add('unit ' + fileName + ';'); list.Add(''); list.Add('interface'); list.Add('{$I frx.inc}'); list.Add('implementation'); list.Add('uses frxRes;'); list.Add('const resXML ='); xml := ReplaceText(xml, #13, ''); xml := ReplaceText(xml, #10, ''); i := 1; while True do begin if (i + 80) < (Length(xml) + 1) then lineWidth := 80 else lineWidth := Length(xml) + 1 - i; if lineWidth = 0 then break; line := Copy(xml, i, lineWidth); list.Add(QuotedStr(line) + '+'); i := i + lineWidth; end; list.Add(''''';'); list.Add('initialization'); list.Add(' frxResources.AddXML(Utf8Encode(resXML));'); list.Add(''); list.Add('end.'); list.SaveToFile(ChangeFileExt(ParamStr(1), '.pas'), TEncoding.Default); list.Free; except on E:Exception do Writeln(E.Classname, ': ', E.Message); end; end.
转自网上作者不明