With The Case Of  Release The Power OF  Visual C++ !   Home Products | Purchase Support | Downloads  
View in English
View in Japanese
View in
View in Franšais
View in Italiano
View in 中文(繁體)
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
VX++ Cross-Platform C/C++
ActiveX COM Products
Technical Support
  General Q & A
Discussion Board
Contact Us


Get Ready to Unleash the Power of UCanCode .NET

C / C++ Drawing Bar Code Tutorials

BarCode Printing, it also with BarCode Library and BarCode Source Code, with Drawing barcode.

First time here?

Product Tour
E-XD++ product walkthrough

Applications built on E-XD++

Product feature comparison

Powerful, flexible, and easy to use Diagram Components.
Powerful and flexible enough to create diagrams exactly the way you want them to appear. So easy to use that you will be able to prototype your application in just a few minutes.

Feature rich.
With features such as automatic layout, multiple layers, collapsible sub-graphs, snap-to connection points, XML, SVG, and more, E-XD++ Have the power and flexibility you need to create sophisticated diagrams, quickly and easily. Events such as click, double-click, hover, select, rubber-band select, copy, delete, resize and move are supported. Operations such as drag-and-drop, unlimited undo/redo, and clipboard operations are common and complex, and are expected by today's sophisticated users. it full supports importing ArcGis, SVG and DXF File format.

Performance and Scalability.
UCanCode E-XD++ Capable of handling many thousands of nodes and edges, up to hundreds of thousands depending upon the complexity of the nodes you wish to draw and the operations you wish to allow. Our graphical classes are extremely lightweight objects enabling outstanding performance.

Save Time and Money and gain Reliability.
A diagram is worth 1,000 words, and E-XD++ is shipped with more than 500,000 lines of well designed and well tested code! It is used by hundreds of the world's most quality conscious companies. It will saves you thousands of hours of complex coding and years of maintenance.


Barcode library

Draw, Print and encode UPCA barcode and UPCE barcode, and EAN13 barcode with VC++ Codes

Library file presented is Barcode.h under Lib directory, which contains inline C++ code for
  • Code39
  • Code93 
  • CodeI2of5
  • Code128A
  • Code128B
  • Code128C
The library file is targeted to Win32, so it can be used by both MFC and Win32 programs. 
All classes are almost the same from user's point of view, only 2 functions are needed to be used.
  1. Encode...()
  2. Draw...(...)
For example, class for Code39 is Barcode39:
Call default constructor first, then call following 2 functions:
BOOL Encode39(const char*pszCodeIn);
void Draw39(HDC hDC,int iX,int iY0,int iY1,const COLORREF clrBar,const COLORREF clrSpace,const int iPenW);
Parameters of above functions:
pszCodeIn: string to be encoded, i.e. "1234567890"
iX: start horizontal position to draw the barcode
iY0,iY1: start and end vertical positions to draw the barcode
clrBar, clrSpace: colors of bar and space
iPenW: width of pen to draw the barcode 

Array for bars and spaces
A byte array is defined in Barcode Base class as BYTE ia_Buf[4096];
Each byte of the array represents a bar or space, bits of the byte are encoded in the format:
First 6 bits are not used.
Last bit is flagged for bar or space.
Last second bit is flagged for wide or narrow.
So, value of the byte means
0x00 = a narrow space
0x01 = a narrow bar
0x02 = a wide space
0x03 = a wide bar Note:
class Barcode Ean13 is special: Last third bit is used by the class to indicate if the bar (space) is longer than others.  

Sample program:

The sample is a dialog based MFC program.
Main dialog is in borderless style, when edit-box Move (refer to picture bellow) gets focus, user can use arrow keys of up, down, left and right to move main dialog.
This feature allows you to compare barcode drawn on main dialog with other barcode programs easily.
You also can use mouse to drag main dialog by clicking on it as clicking on caption of normal windows.

  • Buttons:
    OnTop/OnNormal: set the program as top-most-window or not
    Close: close the program
    Help: display this html file
    Print: print barcode
  • Others
    Style: barcode styles or symbologies
    Map: map-mode used
    Move: move main dialog by arrow keys once it gets focus
    Code: string to be encoded
    X,Y,Height: for print positions, unit is in logic points.
    Pen width: width of one bar or space
Please note
Some MapModes (such as MM_HIENGLISH) can not be displayed properly on screen, you have to test them by printing.


This sample and library file are my test program for barcode, which doesn't include second part: dynamical bitmap of barcode generated from encoding.

Why do I test barcode with bitmap? Here is answer:
As we know, there are three methods for printing:

  1. By drawing 
    Such as LineTo()
  2. By Bitmap
    Such as BitBlt()
  3. By fonts
    Such as TextOut()

Barcode must be printed clearly with high qualities. The only way to print good barcode is by fonts. 
If you try to use the code for commercial purposes, result is very disappointed because this program dose not use fonts.

Screenshot of main dialog

  1. Barcode serial articles by Mr. Neil Van Eps
  2. Articles by Mr. Lam Do Thanh

download source code here.


1 UCanCode Advance E-XD++ CAD Drawing and Printing Solution Source Code Solution for C/C++, .NET V2023 is released!

2 UCanCode Advance E-XD++ HMI & SCADA Source Code Solution for C/C++, .NET V2023 is released!

3 UCanCode Advance E-XD++ GIS SVG Drawing and Printing Solution Source Code Solution for C/C++, .NET V2023 is released!

Contact UCanCode Software

To buy the source code or learn more about with:


Ask any questions by MSN: Yahoo:


Copyright ?1998-2023 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to