?
Solved

serial -> visual c++

Posted on 2003-03-05
5
Medium Priority
?
896 Views
Last Modified: 2012-05-04
hi,
I have a barcodescanner connected with a serialport(rs232) of my computer. How can i read that data with visual c++ ??
i found at Microsoft _bios_serialcom() and bios.h, but i think visual c++ 6 doesn't support it anymore.

Regards
 
0
Comment
Question by:timmmm
[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
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 8074806
See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwbgen/html/msdn_serial.asp ("Serial Communications in Win32") - good article about the basics and pronciples (comes with sample code)
0
 
LVL 3

Expert Comment

by:jlsjls
ID: 8078455
Try to obtain the OPOS driver of this barcode scanner (look at site of manufacturer). Once you have the OPOS driver of it, you can easily use a scanner object. This object does all communication for you.
0
 

Author Comment

by:timmmm
ID: 8087346
Thx for the reply's

jlsjls,
i found the OPOS driver, i installed it.
and i seen it has an service object ID,
but what should i do now.
what code do i have to write to get the data in my editbox?
Can i use the same code when my barcodescanner is attached through RJ45 ??

the OPOS driver:
http://www.metrologic.com/corporate/products/oem/IS4100.htm


thanks in advance,
Tim
0
 
LVL 3

Accepted Solution

by:
jlsjls earned 300 total points
ID: 8087435
First install the OPOS-drivers on your machine.
To use a scanner through OPOS into your application, you could use following code :
LONG lResult = 0;
lResult = m_Scanner.Open("Name of device to Open");
//name of device : see registry (done by setup of OPOS-driver of scanner)
lResult = m_Scanner.Claim(-1);
lResult = m_Scanner.setDeviceEnabled();
lResult = m_Scanner.setDataEventEnabled(TRUE);

//now you can receive events from the scanner object (m_Scanner)
In event-method :OnDataEventScanner(LONG status)
use : CString ScannerData = m_Scanner.GetScanData();
and set : m_Scanner.SetDataEventEnabled(TRUE);
You need to place the String 'ScannerData' into your editbox.
The advance of OPOS is : you don't need to change your code if you change Scanner or way of attachment is changed. The only one need to do, is to make correct settings in registry.  
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

770 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