473,386 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Send raw data to the printer

I have tried the code posted by Microsoft here
http://support.microsoft.com/?scid=kb;EN-US;322090

It works fine in VS2003. But when I try the same code in VS2005
I am getting the following error

PInvokeStackImbalance was detected
Message: A call to PInvoke function
'WindowsApplication2!WindowsApplication2.RawPrinte rHelper::OpenPrinter' has
unbalanced the stack. This is likely because the managed PInvoke signature
does not match the unmanaged target signature. Check that the calling
convention and parameters of the PInvoke signature match the target
unmanaged signature.

The error is generated in the line

If OpenPrinter(szPrinterName, hPrinter, 0) Then
..........
in the class RawPrinterHelper
in the Function SendBytesToPrinter

Can somebody explain to me why it works in 2003 and geneartes an error in
2005. And what can I do to make it work in 2005

Thank you
Mar 16 '07 #1
4 6058
Don't repost questions.

This question was replied to in the original thread.

Thanks,

Seth Rowe
On Mar 16, 10:47 am, "Iouri" <i...@hotsheet.comwrote:
I have tried the code posted by Microsoft herehttp://support.microsoft.com/?scid=kb;EN-US;322090

It works fine in VS2003. But when I try the same code in VS2005
I am getting the following error

PInvokeStackImbalance was detected
Message: A call to PInvoke function
'WindowsApplication2!WindowsApplication2.RawPrinte rHelper::OpenPrinter' has
unbalanced the stack. This is likely because the managed PInvoke signature
does not match the unmanaged target signature. Check that the calling
convention and parameters of the PInvoke signature match the target
unmanaged signature.

The error is generated in the line

If OpenPrinter(szPrinterName, hPrinter, 0) Then
.........

in the class RawPrinterHelper
in the Function SendBytesToPrinter

Can somebody explain to me why it works in 2003 and geneartes an error in
2005. And what can I do to make it work in 2005

Thank you

Mar 16 '07 #2
sorry I posted this question before I saw the previous one sent by somebody
else
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
Don't repost questions.

This question was replied to in the original thread.

Thanks,

Seth Rowe
On Mar 16, 10:47 am, "Iouri" <i...@hotsheet.comwrote:
>I have tried the code posted by Microsoft
herehttp://support.microsoft.com/?scid=kb;EN-US;322090

It works fine in VS2003. But when I try the same code in VS2005
I am getting the following error

PInvokeStackImbalance was detected
Message: A call to PInvoke function
'WindowsApplication2!WindowsApplication2.RawPrint erHelper::OpenPrinter'
has
unbalanced the stack. This is likely because the managed PInvoke
signature
does not match the unmanaged target signature. Check that the calling
convention and parameters of the PInvoke signature match the target
unmanaged signature.

The error is generated in the line

If OpenPrinter(szPrinterName, hPrinter, 0) Then
.........

in the class RawPrinterHelper
in the Function SendBytesToPrinter

Can somebody explain to me why it works in 2003 and geneartes an error
in
2005. And what can I do to make it work in 2005

Thank you


Mar 16 '07 #3
sorry I posted this question before I saw the previous one sent by somebody
else
Actually, that was me ;-)

The reason I asked you to not repeat the question (or at least so
soon) is that it makes it difficult to track the progress of an issue,
since we now have to watch two threads (if we know about the other).
So others could be working to solve an issue that was already solved
in the other thread, or they might post the same suggestions as
another person in the other thread, etc. Basically, it just causes
some confusion which is annoying at best.

Thanks,

Seth Rowe
On Mar 16, 12:25 pm, "Iouri" <i...@hotsheet.comwrote:
sorry I posted this question before I saw the previous one sent by somebody
else"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message

news:11**********************@n76g2000hsh.googlegr oups.com...
Don't repost questions.
This question was replied to in the original thread.
Thanks,
Seth Rowe
On Mar 16, 10:47 am, "Iouri" <i...@hotsheet.comwrote:
I have tried the code posted by Microsoft
herehttp://support.microsoft.com/?scid=kb;EN-US;322090
It works fine in VS2003. But when I try the same code in VS2005
I am getting the following error
PInvokeStackImbalance was detected
Message: A call to PInvoke function
'WindowsApplication2!WindowsApplication2.RawPrinte rHelper::OpenPrinter'
has
unbalanced the stack. This is likely because the managed PInvoke
signature
does not match the unmanaged target signature. Check that the calling
convention and parameters of the PInvoke signature match the target
unmanaged signature.
The error is generated in the line
If OpenPrinter(szPrinterName, hPrinter, 0) Then
.........
in the class RawPrinterHelper
in the Function SendBytesToPrinter
Can somebody explain to me why it works in 2003 and geneartes an error
in
2005. And what can I do to make it work in 2005
Thank you

Mar 16 '07 #4
You can send RAW data to the printer, but, never send reheated data to a
printer!!!

sorry in advance

Mike.

"Iouri" <io***@hotsheet.comwrote in message
news:eo**************@TK2MSFTNGP04.phx.gbl...
>I have tried the code posted by Microsoft here
http://support.microsoft.com/?scid=kb;EN-US;322090

It works fine in VS2003. But when I try the same code in VS2005
I am getting the following error

PInvokeStackImbalance was detected
Message: A call to PInvoke function
'WindowsApplication2!WindowsApplication2.RawPrinte rHelper::OpenPrinter'
has unbalanced the stack. This is likely because the managed PInvoke
signature does not match the unmanaged target signature. Check that the
calling convention and parameters of the PInvoke signature match the
target unmanaged signature.

The error is generated in the line

If OpenPrinter(szPrinterName, hPrinter, 0) Then
.........
in the class RawPrinterHelper
in the Function SendBytesToPrinter

Can somebody explain to me why it works in 2003 and geneartes an error in
2005. And what can I do to make it work in 2005

Thank you


Mar 16 '07 #5

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

Similar topics

1
by: Richard Johnson | last post by:
I am a C++ newbie and am trying to send simple text data to my local printer. My printer is a USB printer and I have tried the following code using my USB port. This code executes but does not send...
1
by: Michael Kilpatrick | last post by:
I'm writing a command-line PHP script that gets executed by a virtual printer (a redirected port using the Redmon tool). The PHP modifies the Postscript data before forwarding it to the real...
3
by: RC | last post by:
I am using docmd.printout to send Reports (formatted as labels) to a barcode label printer. I need to collate the labels so that I print lable 1 twice, then label 2 twice, then label 3 twice, etc....
0
by: notregister | last post by:
For the above article..if i do not installed the printer which i have connected, can i still send the print job over? How can i get the signal frm the printer once the printer finish printing?
4
by: pete | last post by:
Does anyone have a working example of sending raw data to a printer with VB.NET 2005? I've tried this example...
13
by: Susan Beebe | last post by:
I have downloaded the code described in Microsoft article Q154078. I am trying to send raw ZPL (zebra barcode printer) code from Microsoft access. It works just fine if I hard code the actual...
9
by: Peter | last post by:
I have created a small windows app that gathers some user entered data, then prints it to a designated printer. A specific person then collects the prints from the printer and processes the info...
1
by: remya1000 | last post by:
how to send a .txt file to a printer. after creating a .txt file i need to send that .txt file to a printer.using vb.net and while sending that file to printer i need to tell, which printer i need...
0
by: dtnam | last post by:
Hi, I want to do something like that: void doc_PrintPage(object sender, PrintPageEventArgs e) { // draw a rectangle e.Graphics.DrawRectangle(Pens.Black, new Rectangle(10, 10, 100,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.