Hello,
I m writing the Diagnostic code for testing serial communication for
the emulator.
My system is having only two physical ports, COM1 and COM2.
I have checked the application using the virtual serial ports. i m
getting nothing on the hyper terminal after running the application on
the emulator.
I followed the steps like :
1 Open Virtual Serial Port control app and
add a virtual port pair COM4<->COM5.
2. Open emulator's settings dialog and map:
"Serial Port 1" to None.
"Serial Port 2" to COM4.
3. Open Hyper terminal app and attach to COM5/38400/8/N/1.
4. In eVC start a new "WCE Application" project, choose
"A simple Windows CE Application" as template.
5. Add the following code to your WinMain function:
---------------------------------------------------------------------------
HANDLE hDev;
DCB dcb;
DWORD dwWritten;
hDev = CreateFile(TEXT("COM1:"), GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (hDev != INVALID_HANDLE_VALUE)
{
ZeroMemory(&dcb, sizeof(dcb));
dcb.DCBlength = sizeof(dcb);
dcb.BaudRate = CBR_38400;
dcb.Parity = NOPARITY;
dcb.ByteSize = 8;
dcb.StopBits = ONESTOPBIT;
SetCommState(hDev, &dcb);
WriteFile(hDev, "Hello World !!!\r\n", 17, &dwWritten, NULL);
CloseHandle(hDev);
}
---------------------------------------------------------------------------
Please guide me..
Thanks