PRINTING LABELS IN VS 2005 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

PRINTING LABELS IN VS 2005

EdwinCOEdwinCO Posts: 1Member
HELLO.
I HAVE A PROGRAM TO PRINT LABEL DIRECTLY IN TERMIC PRINTER, SO, IT WAS PERFECT IN WIN XP BUT NOW I NEED TO INSTALL IT IN W7 64 BITS AND IT NOT WORK.

MY CODE IS:
[code]Const GENERIC_WRITE As Int32 = &H40000000
Const OPEN_EXISTING As Int32 = 3

Public Declare Auto Function CreateFile Lib "kernel32.dll" _
(ByVal lpFileName As String, ByVal dwDesiredAccess As Integer, _
ByVal dwShareMode As Integer, ByVal lpSecurityAttributes As IntPtr, _
ByVal dwCreationDisposition As Integer, _
ByVal dwFlagsAndAttributes As Integer, ByVal hTemplateFile As IntPtr) As IntPtr

Public Function GetStreamWriter(ByVal port As String) As StreamWriter
Dim Continua As Boolean = False
Dim Cont As Integer
Do While Continua = False
Try
Dim hFich As IntPtr = CreateFile("\PCimpresora", GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)
Dim stream As New FileStream(hFich, FileAccess.Write)
Dim writer As New StreamWriter(stream)
Continua = True
Return writer
Catch ex As Exception
Exit Do
End Try
Loop
End Function[/code]

THE PROBLES IS IN LINE:[code]Dim stream As New FileStream(hFich, FileAccess.Write)[/code] BECAUSE hFich IS IN -1.

PLEASE HELP ME!!!, THANKS

Sign In or Register to comment.