' change COM port number to suit
open "com3:9600,n,8,1" for random as #com
hcom = hwnd(#com)
button #w, " Set DTR ", [setdtr], UL, 20, 20
button #w, "Clear DTR", [clrdtr], UL, 20, 60
button #w, " Set RTS ", [setrts], UL, 20, 100
button #w, "Clear RTS", [clrrts], UL, 20, 140
open "Modem Control test" for window as #w
#w "trapclose [quit]"
wait
[setdtr]
calldll #kernel32, "EscapeCommFunction", hcom as ulong, _SETDTR as long, r as void
wait
[clrdtr]
calldll #kernel32, "EscapeCommFunction", hcom as ulong, _CLRDTR as long, r as void
wait
[setrts]
calldll #kernel32, "EscapeCommFunction", hcom as ulong, _SETRTS as long, r as void
wait
[clrrts]
calldll #kernel32, "EscapeCommFunction", hcom as ulong, _CLRRTS as long, r as void
wait
[quit]
close #com
close #w
end