Windows 7 GetCommState keeps failing with error ERROR_INVALID_FUNCTION


New Member
I am using a Windows 7 machine, and I am trying to follow the C++ example posted here: and I keep entering this if statement
fSuccess = GetCommState(hCom, &dcb);

if (!fSuccess)
// Handle the error.
printf ("GetCommState failed with error %d.\n", GetLastError());
return (2);

And GetLastError returns 1, which I think means ERROR_INVALID_FUNCTION. What does that mean and how do I fix it?

This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.