I need ur help regarding Serial communication in Win32.
The problem, i m having is quite strange. It is related to fParity member of DCB structure
After setting the fparity=True with SetCommState(), when i get DCB structure with GetCommState(), i always find fparity=FALSE.
I have tested it on 3 machine all running windows xp sp2 and standard COM driver but having the same problem.
Its looks as SetCommState is unable to set fparity member of DCB structure.
Plz see the code snippet
// Get the default port setting information.
GetCommState (hPort, &PortDCB);
PortDCB.fParity = TRUE; // Enable parity checking
PortDCB.Parity = ODDPARITY; // 0-4=no,odd,even,m ark,space
// Configure the port according to the specifications of the DCB
// structure.
if (!SetCommState (hPort, &PortDCB))
{
// Could not configure the serial port.
DWORD dwError = GetLastError ();
return FALSE;
}
::GetCommState( hPort, &PortDCB);
//At this place, i found PortDCB.fparity =FALSE
regards,
Asad Jahangir
The problem, i m having is quite strange. It is related to fParity member of DCB structure
After setting the fparity=True with SetCommState(), when i get DCB structure with GetCommState(), i always find fparity=FALSE.
I have tested it on 3 machine all running windows xp sp2 and standard COM driver but having the same problem.
Its looks as SetCommState is unable to set fparity member of DCB structure.
Plz see the code snippet
// Get the default port setting information.
GetCommState (hPort, &PortDCB);
PortDCB.fParity = TRUE; // Enable parity checking
PortDCB.Parity = ODDPARITY; // 0-4=no,odd,even,m ark,space
// Configure the port according to the specifications of the DCB
// structure.
if (!SetCommState (hPort, &PortDCB))
{
// Could not configure the serial port.
DWORD dwError = GetLastError ();
return FALSE;
}
::GetCommState( hPort, &PortDCB);
//At this place, i found PortDCB.fparity =FALSE
regards,
Asad Jahangir
Comment