Home All Groups Group Topic Archive Search About
Author
30 Jun 2006 12:43 PM
Sub-Lt
Hello. Cor Ligthert [MVP]  In:    microsoft.public.dotnet.general recommended
I ask this question here:


We are upgrading one of our apps from VB6 to VS2005(VB).

Barcode printing is part of the app. What we used to do is send the
printer
command directly to the printer. Printer.print {long printer command}
would
work. Since that doesn't exist anymore, how do we go about sending this
printer command to the barcode printer? The drawstring meathod prints the
command as an actual string on the barcode. I think it sees it as a
graphic
only, not an actual string.

Any insight would be appreciated! Thanks.

Author
30 Jun 2006 1:44 PM
Ahmed
Take a look at these links:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprintingprintdocumentclassprinttopic.asp

http://msdn2.microsoft.com/en-us/library/system.drawing.printing.printdocument.print.aspx

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprinting.asp


Sub-Lt wrote:
Show quoteHide quote
> Hello. Cor Ligthert [MVP]  In:    microsoft.public.dotnet.general recommended
> I ask this question here:
>
>
>  We are upgrading one of our apps from VB6 to VS2005(VB).
>
>  Barcode printing is part of the app. What we used to do is send the
>  printer
>  command directly to the printer. Printer.print {long printer command}
>  would
>  work. Since that doesn't exist anymore, how do we go about sending this
>  printer command to the barcode printer? The drawstring meathod prints the
>  command as an actual string on the barcode. I think it sees it as a
>  graphic
>  only, not an actual string.
>
>  Any insight would be appreciated! Thanks.
Author
30 Jun 2006 1:57 PM
Sub-Lt
Thank you for the quick reply.
Actually, I found my solution at
http://support.microsoft.com/?scid=kb;EN-US;322090

The only problem here is that I am gettin the error :

A call to PInvoke function 'GEMS!GEMS.RawPrinterHelper::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.

at

if OpenPrinter(szPrinterName, hPrinter, 0) then
....

Show quoteHide quote
"Ahmed" wrote:

> Take a look at these links:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprintingprintdocumentclassprinttopic.asp
>
> http://msdn2.microsoft.com/en-us/library/system.drawing.printing.printdocument.print.aspx
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprinting.asp
>
>
> Sub-Lt wrote:
> > Hello. Cor Ligthert [MVP]  In:    microsoft.public.dotnet.general recommended
> > I ask this question here:
> >
> >
> >  We are upgrading one of our apps from VB6 to VS2005(VB).
> >
> >  Barcode printing is part of the app. What we used to do is send the
> >  printer
> >  command directly to the printer. Printer.print {long printer command}
> >  would
> >  work. Since that doesn't exist anymore, how do we go about sending this
> >  printer command to the barcode printer? The drawstring meathod prints the
> >  command as an actual string on the barcode. I think it sees it as a
> >  graphic
> >  only, not an actual string.
> >
> >  Any insight would be appreciated! Thanks.
>
>
Author
30 Jun 2006 2:36 PM
Ahmed
Did you declare hPrinter  as a intPtr?


Sub-Lt wrote:
Show quoteHide quote
> Thank you for the quick reply.
> Actually, I found my solution at
> http://support.microsoft.com/?scid=kb;EN-US;322090
>
> The only problem here is that I am gettin the error :
>
> A call to PInvoke function 'GEMS!GEMS.RawPrinterHelper::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.
>
> at
>
> if OpenPrinter(szPrinterName, hPrinter, 0) then
> ...
>
> "Ahmed" wrote:
>
> > Take a look at these links:
> >
> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprintingprintdocumentclassprinttopic.asp
> >
> > http://msdn2.microsoft.com/en-us/library/system.drawing.printing.printdocument.print.aspx
> >
> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprinting.asp
> >
> >
> > Sub-Lt wrote:
> > > Hello. Cor Ligthert [MVP]  In:    microsoft.public.dotnet.general recommended
> > > I ask this question here:
> > >
> > >
> > >  We are upgrading one of our apps from VB6 to VS2005(VB).
> > >
> > >  Barcode printing is part of the app. What we used to do is send the
> > >  printer
> > >  command directly to the printer. Printer.print {long printer command}
> > >  would
> > >  work. Since that doesn't exist anymore, how do we go about sending this
> > >  printer command to the barcode printer? The drawstring meathod prints the
> > >  command as an actual string on the barcode. I think it sees it as a
> > >  graphic
> > >  only, not an actual string.
> > >
> > >  Any insight would be appreciated! Thanks.
> >
> >
Author
30 Jun 2006 2:44 PM
Sub-Lt
Dim hPrinter As IntPtr      ' The printer handle.

I copied the code exactly as shown.

Show quoteHide quote
"Ahmed" wrote:

> Did you declare hPrinter  as a intPtr?
>
>
> Sub-Lt wrote:
> > Thank you for the quick reply.
> > Actually, I found my solution at
> > http://support.microsoft.com/?scid=kb;EN-US;322090
> >
> > The only problem here is that I am gettin the error :
> >
> > A call to PInvoke function 'GEMS!GEMS.RawPrinterHelper::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.
> >
> > at
> >
> > if OpenPrinter(szPrinterName, hPrinter, 0) then
> > ...
> >
> > "Ahmed" wrote:
> >
> > > Take a look at these links:
> > >
> > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprintingprintdocumentclassprinttopic.asp
> > >
> > > http://msdn2.microsoft.com/en-us/library/system.drawing.printing.printdocument.print.aspx
> > >
> > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprinting.asp
> > >
> > >
> > > Sub-Lt wrote:
> > > > Hello. Cor Ligthert [MVP]  In:    microsoft.public.dotnet.general recommended
> > > > I ask this question here:
> > > >
> > > >
> > > >  We are upgrading one of our apps from VB6 to VS2005(VB).
> > > >
> > > >  Barcode printing is part of the app. What we used to do is send the
> > > >  printer
> > > >  command directly to the printer. Printer.print {long printer command}
> > > >  would
> > > >  work. Since that doesn't exist anymore, how do we go about sending this
> > > >  printer command to the barcode printer? The drawstring meathod prints the
> > > >  command as an actual string on the barcode. I think it sees it as a
> > > >  graphic
> > > >  only, not an actual string.
> > > >
> > > >  Any insight would be appreciated! Thanks.
> > >
> > >
>
>
Author
30 Jun 2006 1:51 PM
Ahmed
I missed this one:


"Printers Collection Changes
In Visual Basic 6.0, the Printers collection was used to direct the
output of a Printer object to a different printer. The Printers
collection contained a list of available printers that matched the list
displayed in the Windows Print dialog box.

In Visual Basic .NET, the Printers collection is replaced by the
PrintDialog control, which provides a standard Windows Print dialog
box.
For details, see Printers Collection Changes in Visual Basic .NET
"

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconprintingchangesinvisualbasic70.asp

Sub-Lt wrote:
Show quoteHide quote
> Hello. Cor Ligthert [MVP]  In:    microsoft.public.dotnet.general recommended
> I ask this question here:
>
>
>  We are upgrading one of our apps from VB6 to VS2005(VB).
>
>  Barcode printing is part of the app. What we used to do is send the
>  printer
>  command directly to the printer. Printer.print {long printer command}
>  would
>  work. Since that doesn't exist anymore, how do we go about sending this
>  printer command to the barcode printer? The drawstring meathod prints the
>  command as an actual string on the barcode. I think it sees it as a
>  graphic
>  only, not an actual string.
>
>  Any insight would be appreciated! Thanks.