i have connected my wince device with pc.now from my code i am using following code to open COM1 port and write on it. but it is not opening.Why?
WCHAR* m_PortNam = L"COM1";
m_hCOM = CreateFile(m_PortName, // Specify port device: default "COM1"
GENERIC_WRITE, // Specify mode that open device.
0, // the devide isn't shared.
NULL, // the object gets a default security.
OPEN_EXISTING, // Specify which action to take on file.
0, // default.
NULL);
// default.
if(m_hCOM != INVALID_HANDLE_VALUE)
{
}
else开发者_Go百科
{
//always going here
}
In Windows CE, the port name must include the colon:
TCHAR *m_PortName = _T("COM1:");
精彩评论