Se puede imprimir utilizando el puerto paralelo con tres funciones de la API: -CreateFile -WriteFile -CloseHandleEjemplo: Private Sub Command1_Click() Dim res As Long Dim Linea As String Dim NumBytes As Long Dim BytesEscritos As LonghImpresora = CreateFile("LPT1", GENERIC_WRITE, 0, ByVal 0&, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, &HFFFFFFFF) NumBytes = Len(Text1.Text) Linea = String(NumBytes + 2, 0) Linea = Text1.Text + Chr$(13) + Chr$(10) NumBytes = NumBytes + 2 res = WriteFile(hImpresora, Linea, NumBytes, BytesEscritos, ByVal 0&) res = CloseHandle(hImpresora) End Sublas declaraciones de las funciones son (varían un poco respecto a las del API viewer): Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, ByVal lpBuffer As String, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As Any) As Long Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
|