Bar Code Aplication help

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.

Hi guys,

I need help for a new aplication that work with bar code.
You can help me??
Regards.
Manolo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Max..

I'm working on a barcode application too, at the moment, but as it uses a special label printer which allows to print out Barcodes using a DLL, I'm afraid it won't be a help for you.

Wanted to mention it though, for the little chance it could be helpful...

Basically there are 4 ways to create/print barcodes:

- using a custom dll
- using a barcode font
- computing & drawing it
- using a printer that supports barcode prints

Easiest is the one I used. :wink:

Max.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Num3.

Hi,

I have a 3 of 9 freeware barcode font :)...

I've never found a freeware DLL to build bar codes, or even documentation on how to create the dam things.... Does anyone have docs on barcodes ???



--
Kind Regards

Rui Carvalho

Current PB Projects:
[Construdata 2003 - 30%]
[Step by Step - 50%]
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by TheBeck.

http://www.howstuffworks.com/upc.htm

I remember learning a lot from this article. Great web site too.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.
Originally posted by Num3

Hi,

I have a 3 of 9 freeware barcode font :)...

I've never found a freeware DLL to build bar codes, or even documentation on how to create the dam things.... Does anyone have docs on barcodes ???



--
Kind Regards

Rui Carvalho

Current PB Projects:
[Construdata 2003 - 30%]
[Step by Step - 50%]
Nao Rui, nao tenho ningunha fonte das que voçe precisa.
Cual e a cidade onde vostede vive em Portugal??
Eu vivo en Ourense, na Galicia.
Un saudo,
Manolo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

Spricht jetzt hier jeder wie er will, oder was ??

cya,
...Danilo
(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.

Natuurlijk Danilo, iedereen mag hier zijn eigen taal neerpennen :)
Talaan ng mga pagkain talaan sa mga kaaway talaan sa mga patay

Nou man, zo word het wel een zootje natuurlijk
Regards,

Berikco

http://www.benny.zeb.be/purebasic.htm
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.
Originally posted by Danilo

Spricht jetzt hier jeder wie er will, oder was ??

cya,
...Danilo
(registered PureBasic user)
Haha,
Ok I translate. Sorry.
Not Rui, I don`t have the fonts that you need.
What is you city address in Portugal)
I live in Ourense, Galiacian (Northwest of Spain).
Regards,
Manolo

OK??
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Num3.


Nao Rui, nao tenho ningunha fonte das que voçe precisa.
Cual e a cidade onde vostede vive em Portugal??
Eu vivo en Ourense, na Galicia.
Un saudo,
Manolo
I HAVE 1 font... And I live in Lisbon!

--
Kind Regards

Rui Carvalho

Current PB Projects:
[Construdata 2003 - 30%]
[Step by Step - 50%]
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
Originally posted by Berikco

Natuurlijk Danilo, iedereen mag hier zijn eigen taal neerpennen :)
Talaan ng mga pagkain talaan sa mga kaaway talaan sa mga patay

Nou man, zo word het wel een zootje natuurlijk
Regards,

Berikco

http://www.benny.zeb.be/purebasic.htm
Is this dutch or flemish :)

Have a nice day...

Franco
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by koehler.


FYI, some of you may have heard of the Cue Cat?

This was a barcode scanner that was given out free by the millions at Radio Shack in the US.
There is free software floating around that interfaces with it, so one could probably work with that.

Here is a rather overly-informative site: http://air-soldier.com/~cuecat/
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.
Originally posted by Franco
Is this dutch or flemish :)
Flemish/Dutch, wich is actualy the same
And one line filipino :)

Regards,

Berikco

http://www.benny.zeb.be/purebasic.htm
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Num3.

I found this C code to generate Barcodes...

Maybe someone can translate it to PB (it's out of my league) :)


/////////////////////////////////////////////////////
// Copyright 2003 by David Hillard //
// This information must remain in file //
// //
// Please provide credit for this code in your //
// finished application in the Help/About box //
/////////////////////////////////////////////////////




#include "windows.h"



int BC39_Decode(char letter)
{
int code;
switch(letter)
{
case '*':code = 0x0094;break;
case '1':code = 0x0121;break;
case '2':code = 0x0061;break;
case '3':code = 0x0160;break;
case '4':code = 0x0031;break;
case '5':code = 0x0130;break;
case '6':code = 0x0070;break;
case '7':code = 0x0025;break;
case '8':code = 0x0124;break;
case '9':code = 0x0064;break;
case '0':code = 0x0034;break;
case 'A':code = 0x0109;break;
case 'B':code = 0x0049;break;
case 'C':code = 0x0148;break;
case 'D':code = 0x0019;break;
case 'E':code = 0x0118;break;
case 'F':code = 0x0058;break;
case 'G':code = 0x000D;break;
case 'H':code = 0x010C;break;
case 'I':code = 0x004C;break;
case 'J':code = 0x001C;break;
case 'K':code = 0x0103;break;
case 'L':code = 0x0043;break;
case 'M':code = 0x0142;break;
case 'N':code = 0x0013;break;
case 'O':code = 0x0112;break;
case 'P':code = 0x0052;break;
case 'Q':code = 0x0007;break;
case 'R':code = 0x0106;break;
case 'S':code = 0x0046;break;
case 'T':code = 0x0016;break;
case 'U':code = 0x0181;break;
case 'V':code = 0x00C1;break;
case 'W':code = 0x01C0;break;
case 'X':code = 0x0091;break;
case 'Y':code = 0x0190;break;
case 'Z':code = 0x00D0;break;
case '-':code = 0x0085;break;
case '.':code = 0x0184;break;
case ' ':code = 0x00C4;break;
case '$':code = 0x00A8;break;
case '/':code = 0x00A2;break;
case '+':code = 0x008A;break;
case '%':code = 0x002A;break;



default: code = 0x0000;//don't barcode invalid characters
}//end switch
return code;
}

void BC39_Expand(int code,char* wn)
{
{
if(code & 0x0100){wn[0]='W';}else{wn[0]='N';}
if(code & 0x0080){wn[1]='W';}else{wn[1]='N';}
if(code & 0x0040){wn[2]='W';}else{wn[2]='N';}
if(code & 0x0020){wn[3]='W';}else{wn[3]='N';}
if(code & 0x0010){wn[4]='W';}else{wn[4]='N';}
if(code & 0x0008){wn[5]='W';}else{wn[5]='N';}
if(code & 0x0004){wn[6]='W';}else{wn[6]='N';}
if(code & 0x0002){wn[7]='W';}else{wn[7]='N';}
if(code & 0x0001){wn:)='W';}else{wn:)='N';}
wn[9]='N';
wn[10]=0x00;

}

}


int BC39_Draw(HDC hdc,RECT* rect,char* text,double cpi,BOOL HORIZ)
{
char bcarray[400];
char wn[11];
char tbuffer[100];
char textcopy[100];
int j,code,sl,barwidth,barcodelength,rv;
int ppi,numchars,lengthinxwidths;
double xdim,offset;
HPEN holdpen;
HBRUSH holdbrush;

//copy text to textcopy for modification to uppercase
strcpy(textcopy,text);
if(strlen(textcopy)>30)
{
return 1;
}
strcpy(bcarray,"");
strupr(textcopy);
code=BC39_Decode('*');
BC39_Expand(code,wn);
strcpy(bcarray,wn);
for(j=0;jright - rect->left);
if(diff > 0)
{
rect->right += diff;
rv=1;
}
}
else
{
int diff;
diff=barcodelength-(rect->bottom - rect->top);
if(diff > 0)
{
rect->bottom += diff;
rv=1;
}
}


holdbrush=(HBRUSH)SelectObject(hdc,GetStockObject(BLACK_BRUSH));
holdpen=(HPEN)SelectObject(hdc,GetStockObject(BLACK_PEN));

sl=strlen(bcarray);
if(HORIZ)
{
offset=((rect->right - rect->left)/2) - (barcodelength/2);
}
else
{
offset=((rect->bottom - rect->top)/2) - (barcodelength/2);
}
offset+=xdim*10;
if(HORIZ)
{
for(j=0;jleft+(int)offset,rect->top,rect->left+(int)offset+barwidth,rect->bottom);
offset+=barwidth;
}
else
{
//draw narrow bar
barwidth=(int)xdim;
Rectangle(hdc,rect->left+(int)offset,rect->top,rect->left+(int)offset+barwidth,rect->bottom);
offset+=barwidth;
}

}
else
{
//odd is space
if(bcarray[j]=='W')
{
offset+=(xdim*3);
}
else
{
offset+=(xdim);
}
}

}
}
else //not HORIZ
{
for(j=0;jleft,rect->top+(int)offset,rect->right,rect->top+(int)offset+barwidth);
offset+=barwidth;
}
else
{
//draw narrow bar
barwidth=(int)xdim;
Rectangle(hdc,rect->left,rect->top+(int)offset,rect->right,rect->top+(int)offset+barwidth);
offset+=barwidth;
}

}
else
{
//odd is space
if(bcarray[j]=='W')
{
offset+=(xdim*3);
}
else
{
offset+=(xdim);
}
}

}

}
SelectObject(hdc,holdpen);
SelectObject(hdc,holdbrush);

return rv;
}

--
Kind Regards
Rui Carvalho

Old programmers never die... They branch into a subroutine...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Kale.

handy links:

http://www.bizfonts.com/sourcecode/#VB
http://www.activebarcode.com/

these might be some help :)

--Kale

In love with PureBasic! :)
Post Reply