Barcode library

Library file presented is Barcode.h under Lib directory, which contains inline C++ code for 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
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.

Controls:

Disappoint:

This sample and library file are my test program for barcode, which doesn't include second part: dynamical bitmap of barcode generated from encoding.
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 is not using fonts.

References

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