serial -> visual c++

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
 
timmmmAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jlsjlsConnect With a Mentor Commented:
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
 
jkrCommented:
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
 
jlsjlsCommented:
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
 
timmmmAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.