Hi,
I have a analytical scale connected to a com port .
I test sample testcom3.prg and it works fine but it return the information in 2 parts, (2 MsgInfo box) .
The total lenght is 18 string .
How to return the total 18 strings from the BytesAtPort function ??
Thanks
#include "FiveWin.ch"
function Main()
local oDlg, nComm := InitComm()
DEFINE DIALOG oDlg TITLE "Testing Comm functions"
oDlg:bCommNotify = { | nComm, nStatus | BytesAtPort( nComm, nStatus ) }
ACTIVATE DIALOG oDlg ;
ON INIT EnableCommNotification( nComm, oDlg:hWnd, 20, 20 )
CloseComm( nComm )
return nil
function InitCOMM()
local cDcb, nError, nBytes
local nComm := OpenComm( "COM1", 1024, 128 )
if ! BuildCommDcb( "COM1:9600,n,8,1", @cDcb )
MsgStop( "Error BUILD!" )
return .f.
endif
#ifdef __CLIPPER__
if ! SetCommState( cDcb )
#else
if ! SetCommState( nComm, cDcb )
#endif
MsgStop( "Error SETCOMM!" )
return .f.
endif
return nComm
function BytesAtPort( nComm, nStatus )
local cBuffer := Space(20 )
Msginfo( nSTATUS)
ReadComm( nComm, @cBuffer ) // <<<<---- program will lock here
Msginfo( AllTrim( cBuffer ))
return nil