?
Solved

Serial communication-MSComm control in VC++

Posted on 2000-03-14
4
Medium Priority
?
436 Views
Last Modified: 2013-11-20
I am using MSComm control in VC++. I could write a data into the port . But according to my project 5 bytes should arrive to PC. but when i say
VARIANT a;
a=m_comm.GetInput();
it is returning a bstr which contains only one byte of data of length 1. But the same is perfectly working in VB. I could'nt trace out where is the problem.
0
Comment
Question by:karthik1979
[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 Comments
 
LVL 3

Expert Comment

by:stefanr
ID: 2618733
Does the data contain embedded null characters ('\0')? The mscomm class does not handle those; instead it terminates the string returned there.
0
 

Author Comment

by:karthik1979
ID: 2620393
out of 5 bytes 1 and 5th byte are same .they resemble a special character which appear as letter I in bold
0
 

Accepted Solution

by:
orozco earned 200 total points
ID: 2878602

You have to declare your a variable as the following:

int CControlComView::ReadCharacter(_bstr_t *a)
{
  *a = m_MSComm1.GetInput();
  return a->length();
}

you don't have to declare "a" as a variant.

good luck.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

752 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