sgarton
Posts: 5
Joined: Wed Jun 11, 2008 1:12 am

ActiveX / "comm port in use"

Fri Jul 25, 2008 9:36 am

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

User avatar
johan
GpsGate
Posts: 14888
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: ActiveX / "comm port in use"

Fri Jul 25, 2008 11:55 am

Should be

MyPort.ComPort = 40

Regards,
Johan

Franson Support

sgarton
Posts: 5
Joined: Wed Jun 11, 2008 1:12 am

RE: ActiveX / "comm port in use"

Sun Jul 27, 2008 4:19 am

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

sgarton
Posts: 5
Joined: Wed Jun 11, 2008 1:12 am

RE: ActiveX / "comm port in use"

Mon Jul 28, 2008 10:23 am

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]

Return to “SerialTools”