Search:
Namespaces
Discussions
.NET v1.1
Feedback
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
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com