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

x
?
Solved

Commports in MSVC 5.0

Posted on 1999-09-14
12
Medium Priority
?
310 Views
Last Modified: 2010-04-01
I am looking for a way to access a comport (comm1) using MSVC++ 5.0 on an NT OS. The app will originally be programmed as a consol the eventually aas a Dll so I am trying to avoid having to use any window specific calls which was how I was able to do it before. Your help is appreciated.
0
Comment
Question by:antelope
[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
  • 4
  • 3
  • 3
  • +1
12 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 2046973
0
 

Author Comment

by:antelope
ID: 2046985
Sorry but those all seem to be window/MFC specific. I am looking for something that is not reliant on MFC.
0
 
LVL 23

Expert Comment

by:chensu
ID: 2046988
1. The Platform SDK documentation. No MFC at all.
2. No MFC at all.
3. No MFC.
4. A little bit MFC, can be easily adapted.

What do you mean by "window specific"?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 17

Expert Comment

by:inthe
ID: 2047034
can you not use createfile() api ...
0
 
LVL 1

Expert Comment

by:MatthiasLange
ID: 2047945
use
      HANDLE hCom = CreateFile("COM1",
            GENERIC_READ | GENERIC_WRITE,
            0,
            NULL,
            OPEN_EXISTING,
            FILE_ATTRIBUTE_NORMAL,
            0);
to open the file
        ReadFile(hCom, &c, 1, &bytesrd, NULL)
and
        WriteFile(hCom, pBuf, bytes, &byteswr, NULL)
to read and write.
After opening the port you should adjust the port setting with SetCommState and SetCommTimeouts
0
 
LVL 1

Expert Comment

by:MatthiasLange
ID: 2048062
the only way to get avoid platform/os specific programming is to use a comm library.
0
 
LVL 1

Expert Comment

by:MatthiasLange
ID: 2048071
the only way to get avoid platform/os specific programming is to use a comm library.
0
 
LVL 17

Expert Comment

by:inthe
ID: 2048092
dont you read comments!!
0
 

Author Comment

by:antelope
ID: 2048860
MatthiasLange, thanks you are the third person to suggest this. Now can somebody tell me some info to make this work??
When I try to use the code you sent or the suggested code from Chensu. I originally get a HANDLE undefined error, I checked the help file and it said to include winbase.h (is this correct?) After including that I then get 102 errors all from the MSVC files. Is there something I have to set up in the settings or something?? I am currently set up to use No MFC.
0
 

Author Comment

by:antelope
ID: 2048906
MatthiasLange, thanks you are the third person to suggest this. Now can somebody tell me some info to make this work??
When I try to use the code you sent or the suggested code from Chensu. I originally get a HANDLE undefined error, I checked the help file and it said to include winbase.h (is this correct?) After including that I then get 102 errors all from the MSVC files. Is there something I have to set up in the settings or something?? I am currently set up to use No MFC.
0
 
LVL 23

Accepted Solution

by:
chensu earned 450 total points
ID: 2048967
#include <windows.h>
0
 

Author Comment

by:antelope
ID: 2049036
Thanks chensu!!. You were first and last help. I appreciate it. We will see how well I get on with this and may seek you out again.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

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