Thank you for helping
F_Sc...@po.ia.dk
Frede Schmidt
Sønderborg
Denmark
> Anybody seen some exsamples?
>
>
>Thank you for helping
>
>F_Sc...@po.ia.dk
>Frede Schmidt
>Sønderborg
>Denmark
>
>
Hello Frede,
If your using OpenComm then I assume that you are writing this in Delphi
1.0.
There are a number of steps to open and configure the comms ports, here
is an example 'Open' rtn for a comms module object. It should give you
an idea of what to do..
Defined in object:
- id:integer { Port Id handle }
- PortOpen:Boolean; { Indicates if port open }
- PortStatus :TCOMSTAT; { Status info structure }
- PortError :Word; { Error type code }
- DCB :TDCB; { Comms Data Control Block structure }
Rtn:
function TComms.Open(Name :String):Boolean;
{ This rtn will assign a port to the comms object, returns False if
fail. }
var
NullStr :String;
PortSettings :String;
begin { Open }
NullStr :=Name+#0;
Id:=OpenComm(@NullStr[1],255,255); { Attempt to Open port }
if (id<0) then
begin { fail }
PortOpen :=False;
PortError :=GetCommError(Id,PortStatus);
end { fail }
else
begin { ok }
FlushComm(Id,0); { Flush transmit queue }
FlushComm(Id,1); { Flush receive queue }
{ Port open so attempt to assign DCB settings }
PortSettings :=PortName+','+'9600,n,8,1';
if (BuildCommDCB(@PortSettings[1],DCB) < 0) then
begin { fail }
PortError :=GetCommError(Id,PortStatus);
end { fail }
else
begin { Set Comm State }
{ Set new comms state }
if (SetCommState(DCB)<0) then
begin { fail }
PortError :=GetCommError(Id,PortStatus);
end { fail }
else
begin { Other settings }
PortOpen :=True; { Indicate port is open }
EscapeCommFunction(Id,CLRDTR); { Clear DTR Line }
EscapeCommFunction(Id,CLRRTS); { Clear RTS Line }
SetCommEventMask(id,EV_TXEMPTY) { Enable all events }
end { Other settings }
end { Set Comm State }
end; { ok }
Open :=PortOpen; { Return Status }
end; { Open }
Hope this helps.
--
Moebius
You should take a look at the SilverWare Windows Communications Tool Kit.
It will enable you to do what you need.
You can contact SilverWare Inc. via:
Tele: (972) 247-0131
Fax: (972) 406-9999
For on-line info:
Internet WWW is http://rampages.onramp.net/~silver
Good Luck...
Take care,
John Halovanic
SilverWare Inc.
e-mail: sil...@onramp.net
WWW: http://rampages.onramp.net/~silver