msgHello= Здавствуйте !
msgBye= До свидания …
Файл `#_Msg.RC`
RC1 RCDATA
{
'51 57 45 52 54 59 00'
}
STRINGTABLE
{
1000, "Здравствуйте ."
1001, "До свидания ..."
}
Файл `Proj_L.Dpr`:
{$IMAGEBASE $40000000}
{$APPTYPE CONSOLE}
library Proj_L;
{$R #_MSG.RES}
BEGIN
END.
Файл `Make_DLL.Bat`:
rem –- may be used BRC32 or BRCC32
rem c:\del3\bin\brc32 –r #_msg.rc
c:\del3\bin\brcc32 #_msg.rc
c:\del3\bin\dcc32 /b proj_l.dpr
pause
Файл `Proj.Dpr`
{$APPTYPE GUI}
{$D+,O-,S-,R-,I+,A+,G+}
{$IfOpt D-} {$O+} {$EndIf}
program Proj;
{$IfNDef WIN32}
error: it works only under Win32
{$EndIf}
uses
Windows,
SysUtils,
Classes;
{//////////////////////////////////////////////}
procedure i_MsgBox( const ACap,AStr:String );
{ service routine: simple message-box }
begin
Windows.MessageBox( 0, pChar(AStr), pChar(ACap),
MB_OK or MB_ICONINFORMATION );
end;
{///// TestSList ////}
procedure TestSList;
{ load strings from ini-file via tStringList }
const
cFName = '#_MSG.INI';
var
qSList : tStringList;
begin
qSList := tStringList.Create;
with qSList do try
LoadFromFile( ExtractFilePath(ParamStr(0))+cFName );
i_MsgBox( 'strings collection via VCL:',
Trim(Values['msghello'])+#13+Trim(Values['MSGBYE']) );
finally Free;
end;
end;
{//// TestBuiltInStrRes ////}
RESOURCESTRING
sMsgHello = 'ЯВЕРТЫяверты';
sMsgBye = 'явертыЯВЕРТЫ';
procedure TestBuiltInStrRes;
{ load strings from resources via Delphi`s Linker }
begin
i_MsgBox( 'built-in string resources:', sMsgHello+#13+sMsgBye );
end;
{//////////////////////////////////////////////}
type
tFH_Method = procedure( AFHandle:tHandle );
{ `AFHandle` must be a handle of instance of image (of memory-map)
of a PE-file (EXE or DLL) }
procedure i_Call_FH_Method( AProc:tFH_Method );
{ it is wrapper to load and free a instance of binary
file with resource; also it calls to "AProc()" with
given instance-handle }
const
cLibName = 'PROJ_L.DLL';
var
qFHandle : tHandle;
begin
qFHandle := Windows.LoadLibrary(
pChar(ExtractFilePath(ParamStr(0))+cLibName) );
if qFHandle=0 then
i_MsgBox( 'Error loading library',
Format('Code# %xh',[Windows.GetLastError]) )
else