Solved

Com Port

Posted on 1999-01-09
1
273 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now