Windows 7 GetCommState keeps failing with error ERROR_INVALID_FUNCTION

Discussion in 'Programming and Scripting' started by Dwigt, Apr 19, 2011.

  1. Dwigt

    Dwigt New Member

    Joined:
    Apr 19, 2011
    Messages:
    6
    Likes Received:
    0
    I am using a Windows 7 machine, and I am trying to follow the C++ example posted here: http://msdn.microsoft.com/en-us/library/aa363201(v=VS.85).aspx 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?
     

Share This Page

Loading...