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

definir el tamaño del formulario con el objeto printer...

Estas en el tema de definir el tamaño del formulario con el objeto printer... en el foro de Visual Basic clásico en Foros del Web. hola amigos, necesito urgente una ayudita.... estoy haciendo mi propio formulario y necesito lo siguiente...he definido el tamaño por usuario... Printer.ScaleMode = 7 Printer.PaperSize = ...
  #1 (permalink)  
Antiguo 04/08/2005, 00:01
Avatar de ccca001  
Fecha de Ingreso: agosto-2004
Mensajes: 388
Antigüedad: 19 años, 8 meses
Puntos: 0
Pregunta definir el tamaño del formulario con el objeto printer...

hola amigos, necesito urgente una ayudita....

estoy haciendo mi propio formulario y necesito lo siguiente...he definido el tamaño por usuario...

Printer.ScaleMode = 7
Printer.PaperSize = 256
pero, ¿como defino el tamaño en el codigo?, yo quiero un tamaño personalizado de 14x14 cms (boletas), ¿o esto se define en la impresora?
¿como debo hacerlo?

y otra cosita? como puedo detectar la cola de impresion... si envío 10 hojas(boletas) a la impresora, la idea es saber en que boleta impresa va a cada momento...

gracias...
__________________
"How do you define Real?"
  #2 (permalink)  
Antiguo 04/08/2005, 08:27
Avatar de GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 20 años, 4 meses
Puntos: 53
estas trabajando en windows xp verdad. buscate en las faq's

creo que plante un post alli..

nos vemos..
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila
  #3 (permalink)  
Antiguo 04/08/2005, 11:19
Avatar de ccca001  
Fecha de Ingreso: agosto-2004
Mensajes: 388
Antigüedad: 19 años, 8 meses
Puntos: 0
ok, pero si me puedes dar el post te lo agradeceria mucho.... je je... o si no yo lo busco.... mmm....
__________________
"How do you define Real?"
  #4 (permalink)  
Antiguo 04/08/2005, 11:43
Avatar de GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 20 años, 4 meses
Puntos: 53
comenza a buscar.. je je..

nos vemos..
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila
  #5 (permalink)  
Antiguo 04/08/2005, 11:45
Avatar de GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 20 años, 4 meses
Puntos: 53
http://www.forosdelweb.com/showpost....8&postcount=29

para que no te sintas mal...

nos vemos..
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila
  #6 (permalink)  
Antiguo 04/08/2005, 15:13
Avatar de ccca001  
Fecha de Ingreso: agosto-2004
Mensajes: 388
Antigüedad: 19 años, 8 meses
Puntos: 0
ja ja, muchas gracias...lo que pasa que aqui donde vivo internet es por linea conmutada asi que imaginate la supervelocidad...ja ja
gracias...
__________________
"How do you define Real?"
  #7 (permalink)  
Antiguo 06/08/2005, 14:19
Avatar de ccca001  
Fecha de Ingreso: agosto-2004
Mensajes: 388
Antigüedad: 19 años, 8 meses
Puntos: 0
acerca de detectar la cola de impresion

he aqui un ejemplo que encontre:
puede que haya algo raro por ahi porque yo ya lo modifique, pero tal como está, funciona...


'declaraciones
Dim JobInfo As JOB_INFO_1
Dim hPrinter As Long, res As Boolean, l As Long
Dim BytesNecesarios As Long, InfoDevueltos As Long
Dim buffer() As Byte, PDefault As PRINTER_DEFAULTS, pos As Long, aux As String

Private Sub Timer1_Timer()

Label1 = ""
'abro la impresora por defecto
res = OpenPrinter(Printer.DeviceName, hPrinter, PDefault)
If Not res Then Exit Sub
'miro cuantos bytes necesito
ReDim buffer(1)
l = EnumJobs(hPrinter, 0, 9999, 1, buffer(0), 1, BytesNecesarios, InfoDevueltos)
If BytesNecesarios = 0 Then Exit Sub
'hay algun trabajo, redimensiono el buffer
ReDim buffer(BytesNecesarios - 1)
l = EnumJobs(hPrinter, 0, 9999, 1, buffer(0), BytesNecesarios, BytesNecesarios, InfoDevueltos)
If l = 0 Then Exit Sub
pos = 0
'muestro los datos de cada trabajo
For l = 1 To InfoDevueltos
CopyMemory JobInfo, buffer(pos), LenB(JobInfo)
aux = PointerToString(JobInfo.pStatus)
If aux = "" Then
If JobInfo.Status And JOB_STATUS_DELETING Then aux = aux + "Eliminando "
If JobInfo.Status And JOB_STATUS_ERROR Then aux = aux + "Error "
If JobInfo.Status And JOB_STATUS_OFFLINE Then aux = aux + "Fuera de línea "
If JobInfo.Status And JOB_STATUS_PAPEROUT Then aux = aux + "Sin papel "
If JobInfo.Status And JOB_STATUS_PAUSED Then aux = aux + "En pausa "
If JobInfo.Status And JOB_STATUS_PRINTED Then aux = aux + "Impreso "
If JobInfo.Status And JOB_STATUS_PRINTING Then aux = aux + "Imprimiendo "
If JobInfo.Status And JOB_STATUS_SPOOLING Then aux = aux + "Guardando en la cola "
If JobInfo.Status And JOB_STATUS_USER_INTERVENTION Then aux = "Intervención del usuario requerida "
End If

Select Case JobInfo.Priority
Case MAX_PRIORITY: aux = "Máxima"
Case DEF_PRIORITY: aux = "Por defecto"
Case MIN_PRIORITY: aux = "Mínima"
Case Else: aux = JobInfo.Priority
End Select
pag = JobInfo.PagesPrinted
Label1.Caption = "Boletas Impresas: " & (pag * 2) & _
" De " & "Total Páginas: " & JobInfo.TotalPages

JobInfo.Submitted.wMonth _
& "/" & JobInfo.Submitted.wYear & " " & JobInfo.Submitted.wHour _
& ":" & JobInfo.Submitted.wMinute & ":" & JobInfo.Submitted.wSecond
pos = pos + LenB(JobInfo)
Next l
'cierro la impresora
res = ClosePrinter(hPrinter)
End Sub

en un modulo:

Option Explicit
Declare Function EnumPorts Lib "winspool.drv" Alias "EnumPortsA" (ByVal pName As String, ByVal Level As Long, lpbPorts As Byte, ByVal cbBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Type PORT_INFO_2
pPortName As Long
pMonitorName As Long
pDescription As Long
fPortType As Long
Reserved As Long
End Type
Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" ( _
hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Declare Function CopyPointer2String Lib "KERNEL32" _
Alias "lstrcpyA" ( _
ByVal NewString As String, ByVal OldString As Long) As Long
Public Const PORT_TYPE_NET_ATTACHED = &H8
Public Const PORT_TYPE_READ = &H2
Public Const PORT_TYPE_REDIRECTED = &H4
Public Const PORT_TYPE_WRITE = &H1
Declare Function EnumJobs Lib "winspool.drv" Alias "EnumJobsA" (ByVal hPrinter As Long, ByVal FirstJob As Long, ByVal NoJobs As Long, ByVal Level As Long, pJob As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type

Type JOB_INFO_1
JobId As Long
pPrinterName As Long
pMachineName As Long
pUserName As Long
pDocument As Long
pDatatype As Long
pStatus As Long
Status As Long
Priority As Long
Position As Long
TotalPages As Long
PagesPrinted As Long
Submitted As SYSTEMTIME
End Type
Type PRINTER_DEFAULTS
pDatatype As Long
pDevMode As Long
DesiredAccess As Long
End Type
Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, PDefault As PRINTER_DEFAULTS) As Long
Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Public Const JOB_STATUS_DELETING = &H4
Public Const JOB_STATUS_ERROR = &H2
Public Const JOB_STATUS_OFFLINE = &H20
Public Const JOB_STATUS_PAPEROUT = &H40
Public Const JOB_STATUS_PAUSED = &H1
Public Const JOB_STATUS_PRINTED = &H80
Public Const JOB_STATUS_PRINTING = &H10
Public Const JOB_STATUS_SPOOLING = &H8
Public Const JOB_STATUS_USER_INTERVENTION = 1024
Public Const MIN_PRIORITY = 1
Public Const MAX_PRIORITY = 99
Public Const DEF_PRIORITY = 1


Function PointerToString(p As Long) As String
Dim s As String
s = String(255, Chr$(0))
CopyPointer2String s, p
PointerToString = Left(s, InStr(s, Chr$(0)) - 1)
End Function
__________________
"How do you define Real?"
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 07:56.