Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Com Port

Posted on 1999-01-09
1
275 Views
Last Modified: 2013-11-15
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!


0
Comment
Question by:kctan100
1 Comment
 

Accepted Solution

by:
zona earned 10 total points
ID: 1181804
Very simple,you should call your function case sensetivly.
OpenPort("COM2") instead of OpenPort("Com2");  
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Free runner service software 2 110
best free software for ripping cd's 11 175
VS2015 Redefinition errors 4 68
C++ help/ Toy problem 19 29
A high-level exploration of how our ever-increasing access to information has changed the way we do our jobs.
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifiā€¦
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question