Ver Mensaje Individual
  #2  
Antiguo 12-02-2008
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Reputación: 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