Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IOCTL_SERIAL_WAIT_ON_MASK not working. Help please

Status
Not open for further replies.

CheetahSD

Programmer
Mar 15, 2007
1
US
Hi. I'm trying to setup the IOCTL_SERIAL_WAIT_ON_MASK and IOCTL_SERIAL_SET_WAIT_MASK function on Wince 5.0.
I am issuing a deviceiocontrol call and would like have it wait until a certain character ('k') comes over the comm port.
However, this function never returns. Below is a code snippet. Can anyone help me with this? Or does anyone know of any sample code using these functions on Wince? thanks in advance.
<code>
BOOL bRet;
DWORD dwWaitMask;

DeviceIoControl (portHandle, IOCTL_SERIAL_GET_DCB, NULL, 0, &config, sizeof(DCB), &length, NULL);
config.BaudRate = 9600;
config.StopBits = 1;
config.Parity = 0;
config.ByteSize = 8;
config.EvtChar = _T('k');

DeviceIoControl (portHandle, IOCTL_SERIAL_SET_DCB, &config, sizeof(DCB), NULL, 0, &length, NULL);

dwWaitMask = EV_RXFLAG;
bRet = DeviceIoControl (portHandle, IOCTL_SERIAL_SET_WAIT_MASK, &dwWaitMask, sizeof(DWORD), NULL, 0, &length, NULL);

DWORD EventMask = EV_RXFLAG, Events, junk;

DeviceIoControl (hDrvCom2, IOCTL_SERIAL_WAIT_ON_MASK, &EventMask, sizeof(EventMask), &Events, sizeof(Events), &junk, NULL); // this function call never returns.

Thanks.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top