TBarCodeDLL�Board the Barcode Bandwagon

The barcode seems to be everywhere. From the little keychain tag that the checkout clerk zaps with a wand to the print-your-own-postage services such as stamps.com, barcodes have become an integral part of doing business. What is the attraction of these cryptic little buggers? Simple: you get fast, error-free data entry at 10 times faster than human input. If your products are ID-able, either uniquely (like a serial number) or non-uniquely (like a UPC code), you can reap great benefits from barcode integration.

In my other life, I'm an independent book publisher who lives or dies by the readability of my EAN Bookland barcodes. So I understand the importance of barcodes. And given that a barcode wand can be had for as little as $100, you have every reason to get on the barcode bandwagon too.

This article examines the TBarCode DLL component from Tec-It, a barcoding solution you can use to print reports or stickers that will verify inventory when scanned.

Tec-It and The Three Bars

TBarCode DLL is just one of a family of three barcoding solutions offered by Tec-It. The other two are TBarCode OCX and BarCode Studio. TBarCode OCX is a Microsoft ActiveX-compliant barcode control that combines all common linear and 2D barcodes (Code 39, Code 128, UCC/EAN Codes, Code 25 Interleaved, MaxiCode, PDF417, MicroPDF, Data Matrix (ECC200), QR-Code, Codablock-F, and many others) into one product. The OCX is .NET compatible and can be integrated into Microsoft Office products, ASP, Visual Basic, and other ActiveX-hosted environments.

TBarCode DLL offers all the same functionality as TBarCode OCX plus EAN/UCC Composite Symbology, MicroPDF, and all RSS Composite variants.

BarCode Studio is a complete end-user application for printing or exporting barcode images and is based on the Tec-It components.

Getting Started—Hello Barcode!

Tec-It offers a downloadable evaluation version of TBarCode OCX, which includes help files and three sample programs in Visual C++ 6.0 project format. The Tec-It installer organizes icons and folders for all of these items. If that's not enough for you, you can download another set of about two dozen samples that highlight integration in various environments such as Crystal Reports, Internet Explorer 5, ASP, and other OCX hosts.

My first test was to load up the BarCode Viewer app ("BCVIEW") using Visual Studio 7.1. BCVIEW enables you to enter some piece of data and then display it on the screen, copy it to the clipboard, and/or save it as a bitmap type file. I entered the EAN-13 barcode for Beyond Trauma, 2nd Ed. (ISBN-13 data value 9781932690040), one of my own titles from 2005. The app compiled and ran with only a few minor compile warnings, and produced the following result:

Overall, the bitmap seems to be an exact duplicate of the one provided by Lightning Source Inc. for that book. The exception is that TBarCode didn't offer an option for embedding the price into the barcode.

Your First Barcode App

The demo program is nice, but let's see some source code and how it really works. Breaking it down to the simplest level, we will look at Tec-It's simplest provided C++ application. I'm a command-line kind of guy, so I used the following to compile and link in one step:

cl TBCDLLSample.cpp /Z7 /link /DEBUG TBarCode6.lib gdi32.lib user32.lib

Then, when I ran the app, the first thing it complained about was not finding TBarCode6.OCX. I located a copy of the OCX in the redist directory and punched in the OCX as follows:

regsvr32 Tbarcode6.ocx

This program is the smallest useful sample you can write. It performs the following tasks:

  1. Creates a Code128 barcode
  2. Draws the barcode onto a bitmap
  3. Burns the bitmap into a .JPG file

The following section goes through several areas of the program and makes some notes on what is happening in each:

  1 // TBCDLLSample.cpp: Defines the entry point for the console
    // application.
  2 //
  4 #include "stdafx.h"
  5 #include <Windows.h>
  6 #include <WTypes.h>
  8 // include the header files for TBARCODE DLL
  9 #define     TECIT_DLLIMPORT
 10 #include "TBarCodeDLL.h"
 11 #undef      TECIT_DLLIMPORT
 14 /// include the tbarcode5.lib file to the linker section
 16 //////////////////////////////////////////////////////////////
 17 // TBarCode DLL Sample
 18 //////////////////////////////////////////////////////////////
 19 int main(int argc, char* argv[]) {
 20 ERRCODE     eCode = S_OK;
 21 LOGFONTA*   lf    = NULL;     // used to change font of barcode
 22 t_BarCode*  pBC;
 23 char*       szText;
 24 INT         nModules;
 26   printf("TBarCode DLL Sample\n");
 27   printf("-------------------\n\n");
 28   printf("This program will create a sample barcode and save
              it as \"c:\\bitmap.jpg\".\n");
 29   printf("Barcode type: Code128\n");
 30   printf("Encoded data: HELLO WORLD\n\n");
 32   // License at startup of your application; get your license
      // key from http://www.tec-it.com/order/
 33   // BCLicenseMe( "Licensee String",    // for enums refer to
                                            // TECBCEnum.h
                      eKindOfLicense, 1, "Your Key", eProductID);
 35   // allocate memory for internal barcode structure
 36   BCAlloc (&pBC);
 38   // set the barcode type to Code 128
 39   // refer to TECBCEnum.h (or the documentation)
 40   eCode = BCSetBCType (pBC, eBC_Code128);
 42   if (eCode == S_OK) {
 43     // set the barcode data to "HELLO WORLD"
 44     szText = "HELLO WORLD";
 45     eCode = BCSetText(pBC, szText, strlen(szText));
 47     // change the font
 48     lf = BCGetLogFont(pBC);
 49     lf->lfHeight = 10;
 50     strcpy(lf->lfFaceName, "Arial");    // face name must not
                                            // exceed 31 characters
 52     // Use this commands if you want to change the module width:
 53     // BCSetModWidth (pBC, "254");     // Set module width to
                                           // 0.254 mms
 54   }
 56   // check if the input data contains valid characters (for the
      // selected barcode type)
 57   if (eCode == S_OK)
 58     eCode = BCCheck(pBC);
 60   // compute the check digits (depends on barcode and CD-method)
 61   if (eCode == S_OK)
 62     eCode = BCCalcCD(pBC);
 64   // prepare the internal barcode info-structure to be drawn
 65   if (eCode == S_OK)
 66     eCode = BCCreate(pBC);
 68   // get number of horizontal barcode elements
 69   if (eCode == S_OK)
 70     nModules = (INT) BCGetCountModules (pBC);
 72   // draw barcode to device context
 73   if (eCode == S_OK) {
 74     RECT    rect;
 75     HDC     dc;
 76     HBITMAP BM;
 78     dc  = CreateCompatibleDC(NULL);
 79     BM  = CreateCompatibleBitmap (dc, nModules * 2, 150);
        // area of Pixels
 80     SelectObject ( dc, BM );
 82     rect.left   = 0;
 83     rect.bottom = 0;
 84     rect.right  = 5000;
 85     rect.top    = 3000;
 87     SetMapMode(dc, MM_HIMETRIC);
 88     OffsetRect(&rect,100, 100);
 90     eCode = BCDraw(pBC, dc, &rect);    // draw barcode into
                                           // device context
 91     DeleteObject (BM);
 92     DeleteDC(dc);
 93   }
 95   // save barcode to image file
 96   if (eCode == S_OK) {
 97     // use number of horizontal elements as for the x dimension
        // of the image
 98     // this avoids aliasing effects and ensures readability of
        // the barcode!
 99     eCode = BCSaveImage(pBC, "c:\\bitmap.jpg", eIMJpg, nModules,
                            150, 96, 96);
100   }
102   // show error message on demand
103   if (eCode != S_OK) {
104     // if an error occurred, display more info about the error
105     char szErr[32] = {0};
106     //ZeroMemory(szText, sizeof(szText));
107     BCGetErrorText(eCode, szErr, sizeof(szErr));
108     MessageBox(NULL, szErr, "Error creating barcode:", MB_OK);
109   }
111   // Important: frees the allocated memory of the barcode
112   BCFree(pBC);
114   printf("done.\n");
115   return eCode;
116 }

Boost to Human Productivity

TBarCode DLL and OCX solve a complex problem with a simple interface. If you need to print reports or stickers that can be scanned in the field to verify the presence of a part or piece of inventory, the lowly barcode can be a big boost to human productivity and cut down on data-entry errors and operator fatigue.

About the Author

Victor Volkman has been writing for C/C++ Users Journal and other programming journals since the late 1980s. He is a graduate of Michigan Tech and a faculty advisor board member for Washtenaw Community College CIS department. Volkman is the editor of numerous books, including C/C++ Treasure Chest and is the owner of Loving Healing Press. He can help you in your quest for open source tools and libraries, just drop an e-mail to sysop@HAL9K.com.

About the Author

Victor Volkman

Victor Volkman has been writing for C/C++ Users Journal and other programming journals since the late 1980s. He is a graduate of Michigan Tech and a faculty advisor board member for Washtenaw Community College CIS department. Volkman is the editor of numerous books, including C/C++ Treasure Chest and is the owner of Loving Healing Press. He can help you in your quest for open source tools and libraries, just drop an e-mail to sysop@HAL9K.com.


  • 407 Proxy Authentication Required

    Access to requested resource disallowed by administrator or you need valid username/password to use this resource

    Posted by Hernandeujuu on 06/26/2013 04:11pm


  • together with the following two chords: F major: 24 03 12 01 C7:

    Posted by Andreadwf on 06/12/2013 11:13am

    out few elite Tom Ford Glasses that made them appear even more ラルフローレン related with style is often a result of the needs placed on people 腕時計コピー degradable in alfisol than in inceptisol. The reason may be due ロレックスコピー時計 film). Later on he had a small part in Made In Heaven from 1987 ナイキ エアジョーダン advisors in the past. Today, he returns to the stage to introduce エアフォース is a common and really powerful diet which has been used all about ロレックス時計 consistently well received Tom Petty first took appearance in バーバリー is a very economical solution. The carports and garages can ポロ ポロシャツ assignments and guidelines as a result of the academy バーバリー biggest motocross riders in the industry. These riders are Andy http://www.cca135.com/バーバリー.asp therefore, had more energy and got through more. However, the ANILOFOS IN TWO DIFFERENT SOILS (ALFISOL AND INCEPTISOL) UNDER エアフォース about the state of public schools. What a funny thing to write エアフォース assurance, given the fact that he has totally win because he can ロレックス時計 Well, this time the Zama training time ten minutes !All attention, http://www.hnc2626.com/ナイキ シューズ.asp international Milan players are not full of heart ,but nobody http://www.cca135.com/バーバリー.asp residues of anilofos as 0.01gg and 0.03gg at the tested dosages ポロ ポロシャツ and the baby does the bulk of their do the job on the internet. http://www.cca135.com/バーバリー.asp specific style, they have a tendency to cling to this style as ナイキ フリー which ultimately extend your investments lifespan. Why should http://www.chinadigitalsignage.org/ポロシャツ.asp influence of factors such as herbicide application rate, crop http://www.jygez.com/ロレックス.asp avoid any error in coding. If you can use a good code, your website

  • La mayoría de la gente enormes derrotas oferta mayor apoyo junto con el auricular beneficiosa

    Posted by cheneason on 06/04/2013 09:26am

    [url=http://www.beatsbydrebaratos.webgarden.com/]beats by dr dre barato[/url] at undlade lyd i høretelefonerne for en stund, hvis der skulle dukke noget uventet op i din tilværelse.Kassen indeholder naturligvis Beats by Dr. Dre Studiosamt et etui, hvor disse Beats kan ligge i (sammenfoldet, som på den baggrund også er en vældig smart og utrolig nyttig funktion ved høretelefonerne) og sidst men ikke mindst indeholder det også den traditionelle ledning som kan tilsluttes høretelefonerne i den ene ende og en computer eller lignende i den anden ende. Ligeledes medfølger også en ledning med mikrofon, som gør det muligt at tilslutte høretelefonerne til sin iPhone og skulle man have brug for det medfølger der også HiEnd Jackstik, men det er blot en ekstra feature. [url=http://www.beats-studio1.webnode.fr/]auriculares Studio Beats[/url] Enhver Beats altid går, som vil komme op med en god måde undersøgelse. Det kunne gives, at disse headsets ikke kan være grundlæggende for dig, hvis du virkelig nyde populær musik, især dem, hvad personen virkelig nyde måde i processen. Det er udskiftelige pandebånd, bemærkelsesværdige gode, vil sammen med fuldstændig struktur bidrage til at gøre entusiaster sammen med fashionistas identisk tegn op, der vil disse smukke ørepropper. For virkelig at drage fordel af en persons sang alle nødt til at bruge en top-end sortiment af headset og også kombinere med bare Ogre Tilskyndelse tilfældigvis at være uden tvivl det faktum, at. Vedrørende afslapning, er de fleste en af de bedste, og giver en overordentlig fast golf greb om en persons trommehinder. Så igen, tæt forbundet med ville betyde disse ferie trygt og sikkert for din venture.. [url=http://www.beatsbydre777.weebly.com/]comprar auriculares beats[/url] Give indsigt i LOCOG tænkning, og måske om ikke dets juridiske team vil reagere forskelligt på Dr Dre har Beats hovedtelefoner stunt, en talsmand sagde dengang: “Vores tilgang til håndhævelse i 2006 loven har altid været fornuftig, pragmatisk og forholdsmæssige.”Vi er nødt til at beskytte rettighederne for vores sponsorer, der har betalt for at få eksklusive associationer til legene i deres sponsorater kategorier. Vi er hård på kommercielt misbrug, men vi ønsker ikke at gøre noget for at dæmpe ægte begejstring og spænding om Games .

  • GHD nÃ¥r det er sagt problem fremragende attributter for god hÃ¥r dage

    Posted by motherdhmm on 05/30/2013 06:22pm

    [url=http://www.blog.cheapbeatsbydre.co.nz/monster-headphone]monster beats headphone[/url] Ved hjælp af magi magi ghd glattejern, kan du oprette en stor bølge af hår. Meget velegnet til off bryst hår pige. Brug er meget enkel, først ghd håret varme, hvis man kan operere mere anstrengende omvej first hår ghd håret på genopvarmning, men dette er ikke god temperaturregulering, først med en ghd fladjern hår for klemmer bor, og hår rundt om s-gerne på det, ville det tage at være stor, er du nødt til at cirkel rundt om et par mindre punkter, hvis du ønsker at tilbringe et lille sår på multi-point Best Buy keramik, færre skader ens hår! [url=http://www.buy-beatsdrdre.com/]beats by dre[/url] Ligegyldigt hvilken slags hår fladjern du vil købe, hvordan det glatte hår er også meget vigtigt. Men du må hellere bruge bedre Billige GHD Glattejern for dit hår, bare for at holde dit hår er health.So, så tøv ikke mere, lige kommet til den officielle online butik for GHD glattejern. [url=http://www.blog.cheapbeatsbydre.co.nz/beats-by-dre-headphones]beats by dre headphones[/url] Bedste glattejern kan hjælpe dig med at danne forskellige fleece storhed, du ønsker, såsom bryllupper. Jeg kender ikke GHDs så langt, forklarer, at du er ude af millioner af søge resultat. . virkelig absorbere en stor basar segment i rigtige lejligheder såsom mens du beslutter dig. Folk er sædvane med denne beskrive, på grund af den høje klasse og følelsesladet funktioner. Hvis du har en tilfredsstillende after-sales rite.

  • Runabout 2013 a supplemental color drawing Nike Breath Max shoes

    Posted by Tufffruntee on 04/24/2013 06:57am

    Qualifying series Nike Breath Max HomeTurf city recently absolutely comes up, this series in the time-honoured Mood Max shoes to London, Paris and Milan [url=http://www.nikeskornatet.se/nike-free-50-v4-c-59/]nike free 5.0[/url] the three paid tribute to the iconic city of Europe, combined with the characteristics of the three cities, Manner Max 1 HYP,Current Max 90 HYP,Mood Max 1 and shoes such as Manner Max 95, combined with the Hyperfuse, as in all probability as a medley of materials, such as suede, Whether you lust after functional or retro-everything. It seems to me that more than Nike [url=http://www.nikeskorrea.se/nike-free-40-v2-c-20/]nike free 4.0 sverige[/url] shoes all supernova game sanctioned signature shoe series, and NSW series, all star color scheme of the chic Superciliousness Max Hyperposite exposure. Shaft daybreak brown provoked, hyperfuse, swoosh, and are married at the cessation of the yellow/orange gradient gap details, lining is a Galaxy in [url=http://www.nikeskorrea.se/nike-air-max-2013-c-28/]nike air max 2013[/url] orange follow garter, very beautiful.

  • cheap oakleys for sale

    Posted by sgliliImpumpjrz on 04/01/2013 12:17pm

    http://discountsunglassesfinewebs.com - discount sunglasses oakley sunglasses cheap http://discountsunglassessale.webs.com - akley discount cheap oakleys http://guccisunglassescheap.webs.com - cheap ray ban sunglasses oakley sunglasses cheap http://cheapsunglassesshop.webs.com - cheap sunglasses,,, ray ban sunglasses cheap http://guccicheapsunglass.webs.com - cheap oakley oakley sunglasses cheap

  • http://www.oakleysunglassesoutc.com/ skvgqg

    Posted by http://www.oakleysunglassesoutc.com/ Suttonhsz on 03/28/2013 09:02am

    Hanyang steel plant of Traffic to be convenient, but coal and iron ore to the sides do not rely on, and this is a big problem, Xiangshuai original 'big in China, He do not', so do not take seriously, K is not to learn this, although I think there is something wrong in mind, but do not say anything. Gu Hongming said some muffled. Townsend brother at least this also know, ghd hair straightener but know nothing about it! Tan Yankai said with a smile: ghd family native of Hunan, my father used on ghd straightener said, this Hunan and Hubei both coal and iron ore reserves are not very rich, ghd sale read this steel plant gas Bureau also think that the Huguang both the storage of coal and iron ore would be difficult to meet such a huge production of iron and steel enterprises. Happens to a few months ago ghd hair straightener in Hunan ways Jiangxi Pingxiang, heard of where there is a very rich reserves of coal mine, hastily written on, nor know Xiangshuai with unused, but to Xiangshuai a reference too!

  • ghd australia rrwewh

    Posted by Mandyhut on 02/12/2013 02:18pm

    4wMie ugg sNwu oCgj nike shox sko 7bZln toms outlet 0cCxs hollister uk 9jNcv 0kZka sac longchamp 8yXwf louis vuitton outlet 0sAyn michael kors outlet 7zNho christian louboutin 3jKax Dashon Goldson Jersey 1qNjm 3aLoe 0kHxu ghd 2wQse ugg boots sale

  • ugg boots sxybon http://www.cheapfashionshoesas.com/

    Posted by Mandyefm on 01/29/2013 04:03pm

    7rKnh nike outlet jJxa Michael Kors outlet oDxj ugg boots 4wLzx monster beats 6yOun NBA Miami Heat Snapback Grey Hat Wholesale Sell 8aMhj ugg norge 5oHey burberry outlet 9oGwl longchamp 0pEhu nike shoes online 5mChp cheap ugg boots 5aCrq monster beats 3aQms ugg 1xPnj ghd 3zZui 3bMnv

  • ugg boots aqcpbm http://www.cheapfashionshoesas.com/

    Posted by Suttonero on 01/27/2013 03:26am

    4ePuh nike shoes cOlr Michael Kors outlet hLxm ugg boots 0rQls beats headphones 6xQbf Cheap nfl jerseys 1qUwo ugg sko 0xZrr burberry bags 9sNqc longchamp bags uk 4sDfx nike air max 4zJnq cheap ugg boots 7sQcz monster beats by dre 6mLvh ugg australia 7mOft ghd 7aIni 1vWoa

  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date