Solved

Serial communication-MSComm control in VC++

Posted on 2000-03-14
4
431 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 100 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
 
LVL 2

Expert Comment

by:nandi
ID: 3771279
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
lucky13 challenge 11 165
either24  challenge 19 107
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 1,649
ERP and the other system process verification 5 25
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.

734 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