Kevin Decker
New Member
Gabor,
Opening the port seems to work correctly. I am using CreateFileA to establish the commhandle. Sorry for not including the code before.
RUN CreateFileA (vport,
READ_WRITE,
0,
0,
OPEN_EXISTING,
0,
0,
OUTPUT CommHandle).
IF CommHandle < 0 THEN DO:
MESSAGE
"Invalid comm handle:" CommHandle
VIEW-AS ALERT-BOX ERROR.
QUIT.
END.
SET-SIZE(DCBStructurePointer) = 29.
RUN GetCommState (CommHandle,
INPUT-OUTPUT DCBStructurePointer,
OUTPUT nRC).
IF nRC <>0 THEN DO:
ASSIGN DCBStructure = GET-STRING(DCBStructurePointer,1).
PUT-LONG(DCBStructurePointer,5)=9600.
bit-flags=EXP(2,9) + EXP(2,10).
PUT-LONG(DCBStructurePointer,9)=bit-flags.
PUT-BYTE(DCBStructurePointer,19)=8.
PUT-BYTE(DCBStructurePointer,20)=0.
RUN SetCommState (CommHandle,
INPUT-OUTPUT DCBStructurePointer,
OUTPUT nRC).
IF nRC=0 THEN
MESSAGE
"error setting new parameters"
VIEW-AS ALERT-BOX.
END.
Thanks,
Kevin
Opening the port seems to work correctly. I am using CreateFileA to establish the commhandle. Sorry for not including the code before.
RUN CreateFileA (vport,
READ_WRITE,
0,
0,
OPEN_EXISTING,
0,
0,
OUTPUT CommHandle).
IF CommHandle < 0 THEN DO:
MESSAGE
"Invalid comm handle:" CommHandle
VIEW-AS ALERT-BOX ERROR.
QUIT.
END.
SET-SIZE(DCBStructurePointer) = 29.
RUN GetCommState (CommHandle,
INPUT-OUTPUT DCBStructurePointer,
OUTPUT nRC).
IF nRC <>0 THEN DO:
ASSIGN DCBStructure = GET-STRING(DCBStructurePointer,1).
PUT-LONG(DCBStructurePointer,5)=9600.
bit-flags=EXP(2,9) + EXP(2,10).
PUT-LONG(DCBStructurePointer,9)=bit-flags.
PUT-BYTE(DCBStructurePointer,19)=8.
PUT-BYTE(DCBStructurePointer,20)=0.
RUN SetCommState (CommHandle,
INPUT-OUTPUT DCBStructurePointer,
OUTPUT nRC).
IF nRC=0 THEN
MESSAGE
"error setting new parameters"
VIEW-AS ALERT-BOX.
END.
Thanks,
Kevin