To use the following example code, you must download the Group.xml
file and copy it in your application directory. Click here to download the
Group.xml
file.
In your Delphi application, add the following code in the different sections as
mentioned below:
//Add this code to the implementation section
//====================================
Function SendXMLFileToServer (A: PChar):
Integer;
stdcall; external 'rtslink.dll' name 'SendXMLFileToServer';
Function GetLastErrorMessage (): PChar;
stdcall; external 'rtslink.dll' name 'GetLastErrorMessage';
Function Open (): Integer;
stdcall; external 'rtslink.dll' name 'Open';
//Add this code to the FormCreate event of the form
//=========================================
procedure TForm1.FormCreate(Sender: TObject);
var
cErrorMsg: PChar;
cXMLFile:Pchar;
nResult: integer;
begin //Specify the XML file with full path if
not in application directory
cXMLfile := 'GROUP.XML';
//Connect to the Tally software. Returns
zero if successful
nResult:= Open();
if nResult = 0 then
begin
nResult := SendXMLFileToServer
(cXMLfile);
If nResult <> 0 then
begin
cErrorMsg:=GetLastErrorMessage(); //You
may provide an Error-handling routine here
ShowMessage(cErrorMsg);
End
End
Else
begin
cErrorMsg:=GetLastErrorMessage();
ShowMessage(cErrorMsg);
end
end;