Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Com Port

Posted on 1999-01-09
1
Medium Priority
?
282 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
[X]
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
1 Comment
 

Accepted Solution

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

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
The main intent of this article is to make you aware of ‘Exchange fail to mount’ error, its effects, causes, and solution.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

670 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