Solved

Com Port

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
CD into MP3 19 89
Best process to document customer network information 1 69
WinxDVD Platinum 12 52
FMX TCameraComponent Problem 2 15
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

757 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

22 Experts available now in Live!

Get 1:1 Help Now