Acessa arquivos rtm dentro de uma DLL
Amigos se alguem aqui sober como faco para coloca valores em uma label de um arquivo *.rtm que esta dentro de uma DLL, me ajude por favor pois a varios dias estou quebrando cabeça com isso.
Antecipadamente agradeço qualquer resposta.
Antecipadamente agradeço qualquer resposta.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ppComm, ppRelatv, ppProd, ppClass, ppReport, ppBands,
ppCache, ppDB, ppVar, ppCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
RpGeral: TppReport;
ppDetailBand1: TppDetailBand;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure RpGeralBeforePrint(Sender: TObject);
procedure ppDetailBand1BeforePrint(Sender: TObject);
private
{ Private declarations }
DLLITS : THandle;
TempFileList : TStringList;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
TempFileList := TStringList.create;
//-----------------------------------------------
//- Le A DLL com os Arquivos com extensao (*.rtm)
//- do ReportBuilder
//-----------------------------------------------
DLLITS := LoadLibrary(´DLLITSFIS.DLL´);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ResSt : TResourceStream;
TempFile, TempPath : pchar;
begin
//---- Chama o arquivo ´DECLARAFISCAL´ em forma de relatorio
//---- do Builder
IF DLLITS=0 then exit;
ResSt := TResourceStream.Create(DLLITS, ´DECLARAFISCAL´, pchar(´RTM´));
try
// Get the name of a valid Temporary filename is the
// Windows´ default temp file name
GetMem(TempPath, MAX_PATH);
GetMem(TempFile, MAX_PATH);
GetTempPath(MAX_PATH, TempPath);
GetTempFileName(TempPath, ´RES´, 0, TempFile);
// Make the file a .RTM file so TMediaPlayer can
// use the correct multimedia handler
StrCopy(TempFile, StrCat(TempFile, ´.RTM´));
// Add the temporary file to out temp files list
// so we can delete the file one the program closes.
TempFileList.add(string(TempFile));
// Finally save the resource to the temp file...
ResSt.SaveToFile(string(TempFile));
// ... and open it with MediaPlayer
RpGeral.Template.FileName:=string(TempFile);
RpGeral.Template.LoadFromFile;
//??????????????????????????????????????????????????????
//?? P E R G U N T A
//??????????????????????????????????????????????????????
//?? Como devo proceder para passar valores para as
//?? Label´s dentro do arquivo com extensao (*.rtm)
//?? antes de imprimir.
//?? Ja procurei fazer referencia a uma label, mas no
//?? momento da compilacao o Delphi nao a reconhece.
//??
//?? EX: Lb_Razao.Caption:= ´Dados Variaados´;
//??
//??????????????????????????????????????????????????????
RpGeral.PrintReport;
finally
FreeMem(TempPath);
FreeMem(TempFile);
ResSt.free;
end;
end;
procedure TForm1.RpGeralBeforePrint(Sender: TObject);
begin
RpGeral. lb_razao.Caption:=´ooooo´;
end;
[/code][/code]
Targinosilveira
Curtidas 0