Hi Christian, I recently had to use the SetCommState Windows API function, one of the parameters is a DCB structure:
After some reading, I learned about Bit Fields:
http://msdn.microsoft.com/en-us/library/yszfawxh(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/ewwyfdbe%28VS.71%29.aspx
And in the case of the DCB structure:
http://www.cplusplus.com/forum/windows/70551/
So vfp2c32front was assigning 80 bytes to the structure instead of 28 bytes, because it does not handle bit fields.
So, is there any way to add support for bitfields in vfp2c32front ?
I suppose support will also have to be added to vfp2c32 to read and write to bitfields.
I think this is not really something very important to have, but just wanted to let you know of this issues.
I solved the problem of configuring the serial ports using BuildCommDCB.
typedef struct _DCB {
DWORD DCBlength;
DWORD BaudRate;
DWORD fBinary :1;
DWORD fParity :1;
DWORD fOutxCtsFlow :1;
DWORD fOutxDsrFlow :1;
DWORD fDtrControl :2;
DWORD fDsrSensitivity :1;
DWORD fTXContinueOnXoff :1;
DWORD fOutX :1;
DWORD fInX :1;
DWORD fErrorChar :1;
DWORD fNull :1;
DWORD fRtsControl :2;
DWORD fAbortOnError :1;
DWORD fDummy2 :17;
WORD wReserved;
WORD XonLim;
WORD XoffLim;
BYTE ByteSize;
BYTE Parity;
BYTE StopBits;
char XonChar;
char XoffChar;
char ErrorChar;
char EofChar;
char EvtChar;
WORD wReserved1;
} DCB, *LPDCB;
Using vfp2c32front, I created the structure class. Testing the SetCommState function with this structure, it failed everytime.After some reading, I learned about Bit Fields:
http://msdn.microsoft.com/en-us/library/yszfawxh(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/ewwyfdbe%28VS.71%29.aspx
And in the case of the DCB structure:
http://www.cplusplus.com/forum/windows/70551/
So vfp2c32front was assigning 80 bytes to the structure instead of 28 bytes, because it does not handle bit fields.
So, is there any way to add support for bitfields in vfp2c32front ?
I suppose support will also have to be added to vfp2c32 to read and write to bitfields.
I think this is not really something very important to have, but just wanted to let you know of this issues.
I solved the problem of configuring the serial ports using BuildCommDCB.