.NETGURU
Sending ASCII data to a UNC printer path in .NET
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-io' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Raul Vallestero
Hi,

Can somebody point me to some documentation or sample codes on how to
send ASCII data to a UNC printer path? The data are label printer
commands in ASCII text. I tried using a FileStream object but I need to
supply it with an IntPtr handle of the printer which I don't know how to
get. In Platform SDK I can use the function "CreateFile" to get a handle
but I don't know the .NET equivalent. Any ideas or there is another way
to do this?

Any help is greatly appreciated.

Thank you very much,

Raul Vallestero
Reply to this message...
 
    
Mitch Denny (VIP)
Raul,

You can import the CreateFile function from the Kernel32 libary
into your application code like this:

    [DllImport("kernel32.dll")]
    private static extern IntPtr CreateFile(
        string lpFileName,
        int dwDesiredAccess,
        int dwShareMode,
        LPSECURITY_ATTRIBUTES lpSecurityAttributes,
        int dwCreationDisposition,
        int dwFlagsAndAttributes,
        IntPtr hTemplateFile
        );

You can access the printer using the features in the System.Drawing
namespace too but that probably won't be suitable if you want to
talk directly out the LPT port.

Hope this helps.

----------------------------------------
- Mitch Denny
- Click here to reveal e-mail address
- +61 (414) 610-141
-

-----Original Message-----
From: Raul Vallestero [mailto:Click here to reveal e-mail address]
Sent: Friday, 5 July 2002 01:43
To: ngfx-io
Subject: [ngfx-io] Sending ASCII data to a UNC printer path in .NET

Hi,

Can somebody point me to some documentation or sample codes on how to
send ASCII data to a UNC printer path? The data are label printer
commands in ASCII text. I tried using a FileStream object but I need to
supply it with an IntPtr handle of the printer which I don't know how to
get. In Platform SDK I can use the function "CreateFile" to get a handle
but I don't know the .NET equivalent. Any ideas or there is another way
to do this?

Any help is greatly appreciated.

Thank you very much,

Raul Vallestero
| [ngfx-io] member Click here to reveal e-mail address = YOUR ID |
http://www.aspfriends.com/aspfriends/ngfx-io.asp = JOIN/QUIT

Reply to this message...
 
 
System.IntPtr
System.IO.FileStream




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification