Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

problemas con esta dll para imprimir

Estas en el tema de problemas con esta dll para imprimir en el foro de Visual Basic clásico en Foros del Web. Hola a Todos, quiero crear una dll para utilizarla luego para imprimir he encontrado este código pero no me funciona : Código: 'VERSION 1.0 CLASS ...
  #1 (permalink)  
Antiguo 01/08/2006, 05:19
 
Fecha de Ingreso: septiembre-2003
Mensajes: 341
Antigüedad: 20 años, 7 meses
Puntos: 0
problemas con esta dll para imprimir

Hola a Todos,
quiero crear una dll para utilizarla luego para imprimir
he encontrado este código pero no me funciona :

Código:
 
'VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior = 0   'vbNone
  MTSTransactionMode = 0   'NotAnMTSObject
End
Attribute VB_Name = "cPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public Sub EndDocPrint()
    Printer.EndDoc
End Sub
Public Sub NextPagePrint()
    Printer.NewPage
End Sub
Public Sub skipline(numb As Integer)
    Printer.Font.Name = "draft 17cpi"
    For i = 1 To numb
        Printer.Print
    Next
End Sub
Public Sub Pattern()
'======7==============22==================42==========================  ==72==================92=========103===========================
'      XXXXXXXXXX     XXXXXXXXXXXXXXX     XXXXXXXXXXXXXXXXXXXXXXXXX     XXXXXXXXXXXXXXX     9,9999     9,999,999.99
'Printer.CurrentY = (chrlen * 164)
'Printer.Currentx = (chrlen * 132)
End Sub
Public Sub PrintRPHeading(SupCode As String, SupDesc As String, PO As String, SupInv As String, InvDate)
    Printer.Font.Name = "draft 17cpi"
    spacing = Printer.TextHeight("A") * 0.25
    charlen = Printer.TextWidth("=")
    '
    skipline (2)
    '
    CO = "<UNKNOWN COMPANY>"
    y = Printer.CurrentY
    Printer.CurrentX = ((charlen * 132) - Printer.TextWidth(CO)) / 2
    Printer.Print CO
    '
    y = Printer.CurrentY + spacing
    Title = "Receiving Purchases"
    Printer.CurrentY = y
    Printer.CurrentX = ((charlen * 132) - Printer.TextWidth(Title)) / 2
    Printer.Print Title
    '
    skipline (3)
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 1)
    Printer.Print "Supplier: "; SupCode; " "; SupDesc
    '
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 116)
    Printer.Print "Date: "; Format(Now(), "yyyy/mm/dd")
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 1)
    Printer.Print "PO: "; PO
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 1)
    Printer.Print "Supplier Invoice: "; SupInv; " ", InvDate
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 1)
    Printer.Print String(132, "=")
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 1)
    Printer.Print "    Brand            Model                  Description                 Serial/Batch         Qty         Cost"
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 1)
    Printer.Print String(132, "-")
End Sub
Public Sub PrintRPDetail(Brand As String, Model As String, Desc As String, Serial As String, Qty As String, Cost As String)
    Printer.Font.Name = "draft 17cpi"
    spacing = Printer.TextHeight("A") * 0.25
    charlen = Printer.TextWidth("=")
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 7)
    Printer.Print Brand
    '
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 22)
    Printer.Print Model
    '
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 42)
    Printer.Print Desc
    '
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 72)
    Printer.Print Serial
    '
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 97)
    Printer.Print Qty
    '
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 103)
    Printer.Print Cost
    
End Sub
Public Sub PrintRPFooterDetail(Qty As String, Total_Cost As String)
    Printer.Font.Name = "draft 17cpi"
    spacing = Printer.TextHeight("A") * 0.25
    charlen = Printer.TextWidth("=")
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 72)
    Printer.Print String(40, "-")
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 72)
    Printer.Print "Total Cost..."; "   ", Qty; "   "; Total_Cost
End Sub
Public Sub PrintRPFooter()
    Printer.Font.Name = "draft 17cpi"
    spacing = Printer.TextHeight("A") * 0.25
    charlen = Printer.TextWidth("=")
    '
    y = Printer.CurrentY
    '
    Printer.CurrentY = (charlen * 160)
    Printer.CurrentX = (charlen * 1)
    Printer.Print "Received By:                                           Recorded By:                                             Noted By:"
    '
    skipline (1)
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 1)
    Printer.Print "_________________________                              _________________________                          _________________________"
    
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 1)
    Printer.Print "Remarks:"
    '
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 10)
    Printer.Print String(122, "_")
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 1)
    Printer.Print String(132, "_")
    '
    y = Printer.CurrentY + spacing
    Printer.CurrentY = y
    Printer.CurrentX = (charlen * 1)
    Printer.Print String(132, "_")
End Sub
La verdad es que soy un principiante con visual basic y necesito urgenetemente poder crear esta dll
En los pasos para utlizarla me pone que las siguiente variables:
Código:
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
las tengo que declarar en "details Section have to be Declared"
yo lo he puesto en GENERAL DECLARACIONES , pero al crearla me da un error:
eror en la compilaicon : El procedimiento externo no es válido...

Alguien puede ayudarme?
__________________
---Nuestra recompensa se encuentra en el esfuerzo y no en el resultado. Un esfuerzo total es una victoria completa.-- GHANDI
  #2 (permalink)  
Antiguo 01/08/2006, 11:00
Avatar de erick_arcini  
Fecha de Ingreso: julio-2005
Ubicación: Jaltenco / DF
Mensajes: 1.723
Antigüedad: 18 años, 9 meses
Puntos: 50
por que no creas un modulo usando las variables publicas y listo
  #3 (permalink)  
Antiguo 03/08/2006, 04:25
 
Fecha de Ingreso: septiembre-2003
Mensajes: 341
Antigüedad: 20 años, 7 meses
Puntos: 0
hola erick_arcini
Gracias por reponderme.
Verás , se muy poco de VB y estoy muy perdidom, solo necesito este código para ver si me funciona correctamente generando una dll y luego utilizarla con mis paginas asp.
Las he definido de esta forma pero me dá error:
Código:
 
Public MultiUse As Integer
Public Persistable As Integer
Public DataBindingBehavior As Integer
Public MTSTransactionMode As Integer
 Public DataSourceBehavior As Integer

 MultiUse = -1  'True
 Persistable = 0  'NotPersistable
 DataBindingBehavior = 0  'vbNone
 DataSourceBehavior = 0   'vbNone
  MTSTransactionMode = 0   'NotAnMTSObject
  
  ERROR EL PROCEDIMIENTO EXTERNO NO ES VALIDO
Luego, he probado a definirlas de la siguiente manera, como propiedades, pero no se si es correcto:

Código:
 
Property Get MultiUse() As Integer
    MultiUse = -1  'True
End Property
Property Get Persistable() As Integer
  Persistable = 0  'NotPersistable
End Property
Property Get DataBindingBehavior() As Integer
  DataBindingBehavior = 0  'vbNone
End Property
  
  Property Get DataSourceBehavior() As Integer
  DataSourceBehavior = 0  'vbNone
End Property
  
  
Property Get MTSTransactionMode() As Integer
  MTSTransactionMode = 0   'NotAnMTSObject
End Property
De esta forma no me lanza el error aquí , me lo indica en los
Attribute VB_Name = "cPrint"

Alguna idea?
__________________
---Nuestra recompensa se encuentra en el esfuerzo y no en el resultado. Un esfuerzo total es una victoria completa.-- GHANDI
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:37.