Solved

Serial communication-MSComm control in VC++

Posted on 2000-03-14
4
429 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
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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
method notes when mouse over in eclipse 5 87
"Black Box" Testing of Control System Software 2 51
Capture logon name 13 73
Work with App store 7 52
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

778 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