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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.