Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent help on who to coùmunicate to external application

Status
Not open for further replies.

newprog39

Programmer
Sep 26, 2015
15
DZ
Hi all:

I have imported a library of a software to delphi7 , I have got a file which called WINFIOLLib_TLB.pas.which contain a procedure and interface .

in order to comunicate to that sofware I have found this code on the net but it doesen't work properly .

the first fault I got is ':' expected but '=' found on TForm1 = class(TForm).

Code:
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
TWFEvent = class (TInterfacedObject, IWFEvent)

  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    OpenDialog1: TOpenDialog;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormDblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure Notify(event: SYSINT; const text: WideString); safecall;

  end;

var
  Form1: TForm1;
  WinFIOL_Application1: TWinFIOL_Application;



implementation

{$R *.dfm}

procedure TWFEvent.Notify(event: SYSINT; const text: WideString); safecall;
begin;
Form1.Memo1.Lines.Add(IntToStr (Event));
Form1.Memo1.Lines.Add(String (Text));
procedure TForm1.FormDblClick(Sender: TObject);
Var
Ch: IWFChannel;
Event: TWFEvent;
begin
Ch := WinFiol_Application1.GetChannelPointer(WinFiol_Application1.GetCurrentChannel);
WinFiol_Application1.GetCurrentChannel <> 0
Event := TWFEvent.Create; //
EMask := WFEVENTMASK_ALL; //
Ch.Advise(Channel.Event, EMask);


end;



procedure TForm1.FormCreate(Sender: TObject);
begin
WinFIOL_Application1 := TWinFIOL_Application.Create(self);

end;

procedure TForm1.Button1Click(Sender: TObject);
Var
Chn_Name: String;
New_Ch: Integer;

begin
OpenDialog1.InitialDir := 'C:\Program Files\Element Management\ChnFiles';
If OpenDialog1.Execute Then Chn_Name := OpenDialog1.FileName Else Exit;
WinFIOL_Application1.OpenChannelFile(Chn_Name, 0, New_Ch);
WinFiol_Application1.GetChannelPointer(New_Ch).SetReadBuffer(512, 4);

end;
end.

NB: all fault code are summurized bellow:

[Error] Unit1.pas(25): Undeclared identifier: 'TWinFIOL_Application'
[Error] Unit1.pas(33): ';' expected but '.' found
[Error] Unit1.pas(33): '=' expected but ')' found
[Error] Unit1.pas(33): '=' expected but ';' found
[Error] Unit1.pas(34): Expression expected but 'BEGIN' found
[Error] Unit1.pas(35): Undeclared identifier: 'Event'
[Error] Unit1.pas(37): Statement expected but 'PROCEDURE' found
[Error] Unit1.pas(39): Undeclared identifier: 'IWFChannel'
[Error] Unit1.pas(40): Constant or type identifier expected

what is the wrong on this code ?

thanks for your help and suggestions
 
You should add the libraries which are in your USES statement in the TLB file to your main file
Cheers,
Joop
 
hi again:

you mean this :

WINFIOLLib_TLB.pas & WINFIOLLib_TLB.dcu are located in bellow directory is it normal :

C:\Program Files\Borland\Delphi7\Imports
C:\Program Files\Borland\Delphi7\Projects
C:\Program Files\Borland\Delphi7\Lib

thanks
 
No , I mean the libraries which are in the TLB file in the uses statement .
It shows:
uses Windows, ActiveX, Classes, Graphics, OleServer, StdVCL, Variants;

In your main file are:
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, WINFIOLLib_TLB;

So you need to add the ones which are not already in the main clause:
ActiveX, OleServer and StdVcl.

In at least one of these the SYSINT is declared.
(I did not check in which).
Success,
Joop



 
hi :

now I get the point , thaks a lot of it compile .

greeting
 
Newprog39,

I don't understand, this is the thing I said numerous times??

Do you know how to Copy and paste?

*Sigh*

-----------------------------------------------------
Helping people is my job...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top