Page 1 of 1

ActiveX / "comm port in use"

Posted: Fri Jul 25, 2008 9:36 am
by sgarton
I have got the SerialTools toolkit working well in Visual Basic.Net (VS 2003) but want to make it work in Delphi.

I've imported the ActiveX control, and have some very simple code : but I get a 'Comm port in use' whenever I set enabled to True.

I know the port is not in use, as I can use HyperTerminal or my VB program to get to it.

Any ideas ?

Code snippet :

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
  MyPort:IPort;
begin
license1.LicenseKey := 'yourlicencekeywillvary';
MyPort:=CoPort.Create;
MyPort.ComPort:='COM40';
MyPort.BaudRate:=4800;
MyPort.Enabled:=True; // raises exception 'Comm port in use'
Caption:=MyPort.Read(100,50);
end;
Simon

RE: ActiveX / "comm port in use"

Posted: Fri Jul 25, 2008 11:55 am
by johan
Should be

MyPort.ComPort = 40

Regards,
Johan

Franson Support

RE: ActiveX / "comm port in use"

Posted: Sun Jul 27, 2008 4:19 am
by sgarton
Thanks, but unfortunately not that simple <grin> ...

I had already tried that - I get the same result with 40, '40', 'COM40' and even 'XYZ40'.

If I try port 5 which I know doesn't exist, I get a 'Comm port not does not exist' error message.

It's a bluetooth port, so I am wondering if it's because it's out of the normal range ?

Any other ideas ?

Cheers, Simon

RE: ActiveX / "comm port in use"

Posted: Mon Jul 28, 2008 10:23 am
by sgarton
Doh ... developer error, I have GPSGate and that is grabbing Port 40. In my VB.Net application, I can access Port 40 without closing in GPSGate, but not with the ActiveX version.

Problem solved. Now I have to figure out out to get the events out of the ActiveX object ...


[:D]