Solved

barcode reader programming

Posted on 2000-05-02
12
520 Views
Last Modified: 2011-09-20


I am attempting to write a program  to interface   with  a barcode  scanner.  The PC  in this  

case  is  a small  handheld  unit  made  by  Touchstar  and  runs  the DOS  OS.  I have  been

supplied  library  files  and  sample  .exes as  well as  source  code from TouchStar  for this

particular unit.   To further complicate things, ...the development  tool I am using  is  called  

Mobile Builder 2.0  by  Penright!  corporation.   It  is a C-based  development  tool especially

for handheld computers and  has  lots  of extras for things  like signature capture and uploading  

and  downloading  the  databases that it creates. But  it  uses the M$  Visual C++ 1.5/5.0

compilers to compile.

   Now for the problem,....I am  not  skilled  enough to determine what I have codewise,  nor

skilled enough to begin from scratch.  I am fairly proficient  at  using  the Penright! IDE  to  

build forms,  and  move back and  forth between them, and  some  basic  DB  type things,  but  

not  hardware ! Penright  is Object  Oriented, so  my  goal  is for the user to click  a button  

on the form (a scan button)  and  then be able to scan barcodes with the built in scanner.  Heres  

what  I desire  from the Experts  at EE:

#1.  How do I add the working C code, sent to me , to a button click event inside another program

( also a C program )  Here  is an  example of the Mobile Builder  Code,


BEGIN_EVENT_MAP(frmIntro)
    ON_CTL_EVENT(CtlSelect, btnScan, OnbtnScanCtlSelect)
END_EVENT_MAP()



static BOOLEAN OnbtnScanCtlSelect(EVENTTYPE *pEvent, WORD *pError)
{
      // perform default processing
      DefaultHandler(pEvent, pError);

      // added by CodeAssistant
      //***** here is where I assume  my  code  will need to be

      // return TRUE to continue event routing {{MB1}}
      return(TRUE);
}


#2 Everytime  I start trying to include  the files  in the sample  code into my project,  there  

are  literally  hundreds of  errors  referring to "C:\WINNT\Profiles\Dave\Desktop\creg.h(2) :

error C4226: nonstandard extension used : 'far' is an obsolete keyword" (  this  did  not happen  

with  Borland C++ Builder,  but  I only  tried  that  once,  I know  even less about

Borland...but the guy  swears  this code  is for M$ )  How can I get past this?
 
A copy  of the working barcode scan code that I need to integrate, is posted at this site

http://samhell.com/~intelligrow/scanners.txt     please  feel free to look it over  and  see  how  

I can integrate it  into the above event code   .....  please  explain  all areas of your  

suggestions  and  comments  as  you can  see  I am in way over  my  head  and  can  use  all help

and  assistance.  All  comments  and  suggestions  are  welcomed  and appreciated.


DaveMon
0
Comment
Question by:DaveMon
  • 7
  • 5
12 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2776170
DaveMon, i see some strange thing: you want make something for DOS, but BCB makes only Windows apps. How it?
0
 
LVL 2

Author Comment

by:DaveMon
ID: 2777061


See,  I am  totally  inexperienced  in BCB,  and  was  unaware  of  that.  Do you think the errors  are  caused  by  the  version  of  compiler  I'm  using?  Penright  allows  me  to  select  either  my   C++1.5  or  C++5.0   compilers,   as  well  as  any  installed  Borland compilers (  Which  I now  know  may  only  be  used  on  Win16/32  apps,  corect?


DaveMon
0
 
LVL 2

Author Comment

by:DaveMon
ID: 2777090
Also,   be  sure  to look  at  my  link  using   netscape....( if  it   does  not  look  like  readable  code otherwise....in  Netscape  it   is  easily  read.


DaveMon
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2777237
I saw code: of cource, it is DOS, but BCB don't supports DOS. You must
use some compiler, that suppors DOS.
If you haven't this guy, you can now (free) download  BC 5.1
http://community.borland.com/article/0,1410,20633,00.html

About you problems:
1.
BEGIN_EVENT_MAP(frmIntro)
    ON_CTL_EVENT(CtlSelect, btnScan, OnbtnScanCtlSelect)
END_EVENT_MAP()
This is part of code with using MFC for
Visulal C of MS (and you can't use it
in  DOS apps).
2. "far is absolete..."-> seem me,it is becouse you try translate MFC text with any Boorland Compliler(only in BC 5.x with flag MFC you can make it). For detect write need see creg.h


0
 
LVL 2

Author Comment

by:DaveMon
ID: 2777440


Actually  Im  trying  to compile  with  MS C++ 1.5 I do have a copy of BCB  and I compiled once  with  it  just  for troubleshooting purposes.  The code BEGIN_EVENT_MAP(frmIntro)
    ON_CTL_EVENT(CtlSelect, btnScan, OnbtnScanCtlSelect)
END_EVENT_MAP()
is  actually generated by  the MobileBuilder IDE  ( I am  only  required  to  create the code  near  where  my  note  about  my  code  is.

Here  is creg.h
////////////////////////////

void far creg (int reg, int value);
void far int3 ();

int far cart_inpb (int index);
int far cart_inpw (int index);
void far cart_outpb (int index, int val);
void far cart_outpw (int index, int val);
int far cart_last_outpb (int index);
int far cart_last_outpw (int index);
////////////////////////////////////

Thanks  for  you  help


DaveMon
0
 
LVL 2

Author Comment

by:DaveMon
ID: 2777532


Additionally,  there  are  two API exe programs  that  must  be loaded running  on the  PC  before  a MobileBuilder exe  program can run....(  I assume  these do the touchscreen functions  as well  as  the signature  capture  features )  This  might  explain  why there  are  things thatlook  like  they  would  not  work  on a  pure  DOS  program.


DaveMon
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 100 total points
ID: 2778289
i don't see something wrong in creg.h,
exepting one thing: far is obsolet(in BCB all far), and you can tray delete all "far".
0
 
LVL 2

Author Comment

by:DaveMon
ID: 2778621


Do you mean that the word  far   is  now  obsolete  in  all  C  code?  I dont  really  use  borland  at  all....so   should  I just  delete  the  words  far  from the  code?


DaveMon
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2780117
What do you use?
0
 
LVL 2

Author Comment

by:DaveMon
ID: 2780614
M$ Visual C++ 1.5
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2781758
O, with this compiler i can't help.
I work with all BC, but not VC, sorry.
0
 
LVL 2

Author Comment

by:DaveMon
ID: 2797966
Thanks  Alex  I appreciate your assistance.......
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now