kctan100
asked on
Com Port
void OpenPort(LPCTSTR szPortNum)
{
HANDLE hCom = CreateFile(szPortNum,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
}
What parameter should I pass to the above function if I were to open a com port (COM2) ?
I tried something like this :
OpenPort("Com2");
but the CreateFile() return an invalid handle.
Thank you!
{
HANDLE hCom = CreateFile(szPortNum,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
}
What parameter should I pass to the above function if I were to open a com port (COM2) ?
I tried something like this :
OpenPort("Com2");
but the CreateFile() return an invalid handle.
Thank you!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.