- Code: Select all Expand view
- #include "FiveWin.ch"
static hBmpKon:= { "green" , "red" }
function Main()
DEFINE DIALOG oDlg RESOURCE "Ulaz"
REDEFINE BTNBMP oBmpRam ID 32 OF oDlg RESOURCE "sRed" ;
ACTION (nComRam:=InitRam(), WriteComm(nComRam, "$01"+"6"+chr(13)) ) // Start
oDlg:bCommNotify = { | nComUlz, nStatus |oCont:SetBmp( hBmpKon[ 1 ] ), BytesAtPort( nComRam, nStatus ),;
EnableCommNotification( nComRam, oDlg:hWnd, 1, -1) }
REDEFINE BITMAP oCont RESOURCE "Red";
ADJUST ID 1022;
WINDOW oDlg
.
.
.
.
ACTIVATE DIALOG oDlg
CloseComm( nComUlz )
return nil
//----------------------------------------------------------------------------//
static function BytesAtPort( nComRam, nStatus )
local cBufRam := Replicate(Chr(255),1024)
ReadComm( nComRam, @cBufRam )
cBufRam:=StrTran(cBufRam,Chr(255),'')
.
.
.
.
FlushComm(nComRam,1)
WriteComm(nComRam, "$01"+"6"+chr(13))
return nil
If for any reason do not get a response to the command WriteComm (nComRam, "$ 01" + "6" + chr (13)) should execute oConto: SetBmp (hBmpKon [0]). How?