Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This code sample is named TTY. It demonstrates how to open, configure, and close, a serial communications port, and perform read/write operations for a TTY terminal emulation application.
Feature Area
Serial Communications Reference(Core OS Services)
Relevant APIs
CloseHandlefunction
COMMTIMEOUTSstructure
CreateFilefunction
CreateThreadfunction
DCBstructure
EscapeCommFunctionfunction
GetCommModemStatusfunction
GetCommStatefunction
GetCommTimeoutsfunction
GetLastErrorfunction
MessageBoxfunction
SetCommMaskfunction
SetCommStatefunction
WaitCommEventfunction
Usage
-
Navigate to the solution file (*.sln), and double-click it. By default, the solution file is copied to the following folder:
C:\Program Files\Windows Mobile 6.5.3 DTK\Samples\PocketPC\CPP\win32\Tty
Microsoft Visual Studio launches and loads the solution.
-
Build the solution (Ctrl+Shift+B).
-
Deploy the solution (F5).
-
On the desktop, open a hyper-terminal, choose "Com1" or "Com2" and the baud rate (for example, 9600).If you connected the mobile device with the desktop through serial connection by using "com1", then choose "com2". Otherwise, choose "com1".
-
Connect the mobile device to the desktop through the chosen com port.
-
Launch the TTYapplication on the mobile device.
-
Type letters on the hyper-terminal and you'll see them appear in the TTYapplication window (and vice versa).
Remarks
The mobile device must have an available COM port, and it should be connected through the COM port to the desktop.
Development Environments
Pocket PC SDK:Windows Mobile Professional SDK
Development Environment:Visual Studio 2005 or 2008.
ActiveSync:Version 4.5.