ACTUALMENTE, TENGO UN PROGRAMA QUE UTILIZO PARA IMPRIMIR ETIQUETAS EN VARIAS IMPRESORAS TÉRMICAS, Y TODO FUNCIONABA BIEN HASTA QUE EMPEZARON A LLEGAR ORDENADORES CON SO W7, AHORA NO ME IMPRIME PORQUE NO ME GENERA EL HANDLE DE IMPRESIÓN.
PARA ELLO UTILIZO:
Código:
EL ERROR SALE ENConst 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("\\PC\impresora", 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
Dim stream As New FileStream(hFich, FileAccess.Write)
AL SER hFich DE VALOR -1.
SI ALGUIEN PUEDE ECHARME UN CABLE LO AGRADECERÍA.....
UN SALUDO