473,586 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

printint problem

I'm trying to print out barcodes within my program using Code128B
fonts
The code is something as follows:

strDocID = CalculateCheckS um(strDocID);
CRect rectBarcode = PrintText(pDC, rectFolder.bott om+m_nTextSpaci ng *
10, rect, strDocID, ALIGN_CENTER);
CString PrintContainerL abel::Calculate CheckSum(CStrin g barcode)
{
int checkSum;
CString Code128b;

char letter;
int val = 104;
checkSum = val;

for (int i = 0; i < barcode.GetLeng th(); i++)
{
letter = barcode.GetAt(i );
val = letter;
val -= 32;
checkSum += val * (i + 1);
}

int moduloValue = checkSum % 103;
moduloValue += 32;

Code128b = char(202);
Code128b += barcode;
Code128b += char(moduloValu e);
Code128b += char(138);

return Code128b;
}
something that I absolutely can not figure out is that it doesnt work
for "1593387" - prints out a weird character at the end of my barcode.
For any substring of this or if I add any more values, miraculously
starts working.
If anybody has any suggestions, I would greatly appreciate!
Anton

Oct 4 '07 #1
2 1478
gr********@gmai l.com wrote:
I'm trying to print out barcodes within my program using Code128B
fonts
The code is something as follows:

strDocID = CalculateCheckS um(strDocID);
CRect rectBarcode = PrintText(pDC, rectFolder.bott om+m_nTextSpaci ng *
10, rect, strDocID, ALIGN_CENTER);
This looks like windows specific code which makes it OT here, you would
get better responses on a windows programming group.

--
Ian Collins.
Oct 4 '07 #2
<gr********@gma il.comwrote in message
news:11******** **************@ 19g2000hsx.goog legroups.com...
I'm trying to print out barcodes within my program using Code128B
fonts
The code is something as follows:

strDocID = CalculateCheckS um(strDocID);
CRect rectBarcode = PrintText(pDC, rectFolder.bott om+m_nTextSpaci ng *
10, rect, strDocID, ALIGN_CENTER);
CString PrintContainerL abel::Calculate CheckSum(CStrin g barcode)
{
int checkSum;
CString Code128b;

char letter;
int val = 104;
checkSum = val;

for (int i = 0; i < barcode.GetLeng th(); i++)
{
letter = barcode.GetAt(i );
val = letter;
val -= 32;
checkSum += val * (i + 1);
}

int moduloValue = checkSum % 103;
moduloValue += 32;

Code128b = char(202);
Code128b += barcode;
Code128b += char(moduloValu e);
Code128b += char(138);

return Code128b;
}
something that I absolutely can not figure out is that it doesnt work
for "1593387" - prints out a weird character at the end of my barcode.
For any substring of this or if I add any more values, miraculously
starts working.
If anybody has any suggestions, I would greatly appreciate!
Anton
Most likely your checksum calculation is wrong and for 1593387 it produces a
value outside of the barcode char set. Try taking a look at moduloValue for
ones printed correctly and ones with this "weird character".
Oct 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3058
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in the context of a main window. The problem does not occur on HPUX or Linux. The following simple example code illustrates the problem and the...
11
3744
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class (ClassB* b; b->func(); ) the base-class function is called instead of the new function in the derived class. All other similar functions (virtual in...
0
2016
by: Refky Wahib | last post by:
Hi I need Technical Support I finished a Great project using .Net and SQL Server and .Net Mobile Control My Business case is to implement this Program to accept about 1 Million concurrent users So I designed the project as master Node that has all administration
9
2235
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application which makes calls to the service. We are using tcp channel which is using binaryformatter by default. The problem is that after a certain number of...
117
7147
by: Peter Olcott | last post by:
www.halting-problem.com
28
5194
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass(); .... and then call the virtual method, why is it that the base class's method is called instead of the overridden method? How do I fix this if I...
6
3793
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length is more that 1249 bytes, then the progress bar of the browser will move too slow and then displaying that the page not found!!!! If the message is...
16
4889
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by Microsoft must be installed on their servers. Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP fault responses. This can be...
2
4541
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was set to...it is set to false. Can someone show me what I am doing wrong and tell me the correct way? Thank you. In the page load event, I am...
3
3377
by: ypytt | last post by:
Hi all, I'm developing a Windows application in C#. It generates reports using ReportViewer. These reports should be printed on a dot matrix printer. However, there is a problem. The application runs on multiple computers connected in a local network, the printer is connected to the network also. When the report is generated and the Print...
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7954
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.