Click to open or copy the Serial project files.
The COMM sample (TTY) demonstrates using the Win32 communications functions while maintaining a common code base with 16-bit Windows code.
The program performs communications using the functions OpenFile, ReadFile, SetCommState, SetCommMask, WaitCommEvent, WriteFile, and CloseFile.
The program creates a background thread to watch for COMM receiver events and posts a notification message to the main terminal window. Foreground character processing is written to the communications port.
Simple TTY character translation is performed and a screen buffer is implemented for use as the I/O window.
Overlapped file I/O techniques are demonstrated.
This sample uses the following keywords:
_fmemmove; _fmemset; aboutdlgproc; autowrap; baudrate; beginpaint; bitblt; bytesize; checkdlgbutton; choosefont; clearcommerror; closeconnection; closehandle; column; comdev; commwatchproc; connected; createcaret; createcompatibledc; createevent; createfile; createfontindirect; createthread; createttyinfo; createwindow; cursorstate; defwindowproc; deletedc; deleteobject; destroycaret; destroyttyinfo; dialogboxparam; dispatchmessage; displayerrors; enablemenuitem; enablewindow; enddialog; endpaint; escapecommfunction; exttextout; fgcolor; fillcombobox; flowctrl; free; freeprocinstance; get_prop; getcommstate; getdc; getdlgitem; getdlgitemtext; gethinst; getlasterror; getmenu; getmessage; getnpttyinfo; getoverlappedresult; getparent; getprop; getsyscolor; gettextmetrics; getversion; getwindowlong; getwindowrect; gomodaldialogboxparam; hidecaret; hthread; httyfont; initapplication; initinstance; invalidaterect; isdlgbuttonchecked; killttyfocus; lfttyfont; loadaccelerators; loadbitmap; loadcursor; loadicon; loadstring; localalloc; localecho; localfree; lstrcpy; lstrlen; makeintatom; makeintresource; makelong; makeprocinstance; malloc; max; memset; messagebeep; messagebox; min; movettycursor; newline; openconnection; outputdebugstring; painttty; parity; port; postevent; postmessage; postquitmessage; processttycharacter; purgecomm; read_os; readcommblock; readfile; registerclass; releasedc; remove_prop; removeprop; resetttyscreen; rgb; row; screen; scrollttyhorz; scrollttyvert; scrollwindow; selectobject; selectttyfont; senddlgitemmessage; sendmessage; set_prop; setbkcolor; setbkmode; setcaretpos; setcommmask; setcommstate; setcommtimeouts; setcursor; setdlgitemtext; setnpttyinfo; setprop; setscrollpos; setscrollrange; settextcolor; settingsdlginit; settingsdlgproc; settingsdlgterm; setttyfocus; setupcomm; setupconnection; setwindowlong; showcaret; showwindow; sizetty; stopbits; termwnd; threadid; translateaccelerator; translatemessage; ttywndproc; updatewindow; usecnreceive; waitcommevent; winmain; write_os; writecommblock; writefile; writettyblock; wsprintf; xchar; xoffset; xonxoff; xscroll; xsize; ychar; yoffset; yscroll; ysize