Предварительно идем в Project->Resources and images и загружаем из файла текст.
procedure TForm1.Button1Click(Sender: TObject);
var
ResHandle:HRSRC;
hGlob:THandle;
thestring:AnsiString;
eu:PAnsiChar;
begin
// Resource_1 - Имя ресурса
// RT_RCDATA - Тип ресурса
ResHandle:=FindResource(hInstance,'Resource_1',RT_RCDATA);
hglob:=LoadResource(hInstance,ResHandle); // Returns a handler to the data of a resource
eu:=LockResource(hGlob); // Returns a pointer to a resource
theString:=eu;
Memo1.Lines.Text:=theString;
//ShowMessage(thestring);
end;
http://stackoverflow.com/questions/6547696/how-can-my-program-read-a-string-from-a-res-file
procedure TForm1.Button1Click(Sender: TObject);
var
ResHandle:HRSRC;
hGlob:THandle;
thestring:AnsiString;
eu:PAnsiChar;
begin
// Resource_1 - Имя ресурса
// RT_RCDATA - Тип ресурса
ResHandle:=FindResource(hInstance,'Resource_1',RT_RCDATA);
hglob:=LoadResource(hInstance,ResHandle); // Returns a handler to the data of a resource
eu:=LockResource(hGlob); // Returns a pointer to a resource
theString:=eu;
Memo1.Lines.Text:=theString;
//ShowMessage(thestring);
end;
http://stackoverflow.com/questions/6547696/how-can-my-program-read-a-string-from-a-res-file
Комментариев нет:
Отправить комментарий