Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Impresión
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 11-02-2008
Avatar de MAXIUM
MAXIUM MAXIUM is offline
Miembro
 
Registrado: may 2005
Posts: 1.488
Poder: 20
MAXIUM Va camino a la fama
Exclamation Determinar puerto de impresión

Hola, quisiera saber que tipo de puerto usa la impresora determinada. Uso el siguiente código pero al mostara el tipo de puerto me aparece en blanco.

Código Delphi [-]
Uses Printers;

Type
      TPrinterDevice = Class Driver, Device, Port: String;

TForm1.Button1Click(Sender:TObject);
Begin
    // Para obtener el nombre de la impresora.   
       Label1.Caption:= TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex].Device;

    // Para obtener el tipo de puerto.   
       Label2.Caption:= TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex].Port;
End;
Responder Con Cita
  #2  
Antiguo 12-02-2008
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Poder: 20
cHackAll Va por buen camino
Código Delphi [-]
uses WinSpool;
 
procedure TForm1.Button1Click(Sender: TObject);
var
 Size, Count, Index: Cardinal;
 Items: array [0..2047] of TPrinterInfo5;
 Default: array [0..255] of Char;
begin
 EnumPrinters(PRINTER_ENUM_LOCAL + PRINTER_ENUM_CONNECTIONS, nil, 5, @Items, SizeOf(Items), Size, Count);
 GetProfileString('windows', 'device', '', @Default, SizeOf(Default) - 1);
 Index := 0; while not (Default[Index] in [#0, ',']) do Inc(Index);
 Default[Index] := #0;
 for Index := 0 to Count - 1 do
  if not LongBool(lstrcmpi(@Default, Items[Index].pPrinterName)) then
   MessageBox(Handle, Items[Index].pPortName, nil, 0);
end;

Última edición por cHackAll fecha: 12-02-2008 a las 03:45:49. Razón: cambio lstrcmp por lstrcmpi (CASE INSENSITIVE)
Responder Con Cita
  #3  
Antiguo 12-02-2008
Avatar de MAXIUM
MAXIUM MAXIUM is offline
Miembro
 
Registrado: may 2005
Posts: 1.488
Poder: 20
MAXIUM Va camino a la fama
Muchisimas gracias, funciona de maravillas.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Determinar la Calidad de Impresión!! _Willa Impresión 0 10-04-2006 21:10:52
Impresion en red mediante el puerto!!!! lroblesco Impresión 7 14-10-2005 05:30:26
Impresion directo al puerto (en red) ctronx Impresión 4 20-09-2004 23:40:27
Impresión directa en puerto COM altp Impresión 10 22-05-2004 17:26:03
Impresión directa en puerto USB guillotmarc Impresión 2 22-05-2004 12:05:08


La franja horaria es GMT +2. Ahora son las 09:06:52.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi