Wili,
Eu utilizo sem problemas.
ex:
static ncomm2
define window oWndb mdichild of oWnd
if !empty(TPortcom)
oWndb:bCommNotify := { | nComm2, nStatus | FWBytesAtPort( nComm2, nStatus , cMod ) }
endif
activate window owndb maximized on init (if(!empty(TPortcom),if(FWlInitModem(TBitsSeg,TPortcom,@lComClose),;
EnableCommNotification( nComm2, oWndb:hWnd, 20, 20 ),),))
static function FWBytesAtPort( nComm2, nStatus, cMod )
local cBuffer:=Space( 20 ),nleitor:=0
if empty(ncgetme) .and. oWndChild==Nil
ReadComm( nComm2, @cBuffer )
...
endif
return nil
static function InitModem(TBitsSeg,TPortcom,lComClose)
local cDcb, nError, cPorVel
cPorVel := TPortcom+":"+alltrim(str(TBitsSeg))+",n,8,1"
nComm2 := OpenComm( TPortcom, 1024, 128 )
lComClose := .f.
if ! BuildCommDcb( cPorVel, @cDcb )
nError := GetCommError( nComm2 )
MsgInfo( cDescContrF2+" - Leitor - BuildCommDcb Error: " + alltrim(Str( nError )))
CloseComm( nComm2 )
return .f.
endif
if ! SetCommState( nComm2, cDcb )
nError := GetCommError( nComm2 )
MsgInfo( cDescContrF2+" - Leitor - SetCommState Error: " + alltrim(Str( nError )) )
CloseComm( nComm2 )
return .f.
endif
return .t.