snoopy123123
Member
- Joined
- Jun 24, 2013
- Messages
- 6
- Programming Experience
- 5-10
Hello I am using the following code that was used in a different application in VS 2005 to print to a Printer via LPT1 port.
I am using VS2010 and the application completely locks up at the fsPrint.Write command. No exception, nothing. Does anyone see what I am doing wrong ?
I am using VS2010 and the application completely locks up at the fsPrint.Write command. No exception, nothing. Does anyone see what I am doing wrong ?
VB.NET:
[COLOR=#000000][FONT=Consolas][SIZE=2]Dim hParallelPort As Microsoft.Win32.SafeHandles.SafeFileHandle
hParallelPort = CreateFile("LPT1", GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)
[/SIZE][/FONT][/COLOR][FONT=Consolas][SIZE=2][COLOR=#000000]Dim bBuffer() As Byte = System.Text.Encoding.ASCII.GetBytes(Buffer)[/COLOR]
[COLOR=#000000]Dim fsPrint As New FileStream(hParallelPort, FileAccess.Write, bBuffer.Length, False)[/COLOR]
[COLOR=#000000]
fsPrint.Write(bBuffer, 0, bBuffer.Length)
fsPrint.Close()[/COLOR]
[COLOR=#000000]hParallelPort.Close()[/COLOR]
[/SIZE][/FONT]
[FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]