Ver Mensaje Individual
  #2  
Antiguo 27-11-2009
Avatar de ElKurgan
[ElKurgan] ElKurgan is offline
Miembro Premium
 
Registrado: nov 2005
Posts: 1.235
Reputación: 20
ElKurgan Va camino a la fama
[quote=caifan_0883;347555]
Código:
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(lstrcmp(@default,Items[Index].pPrinterName)) Then
         Begin
               Messagebox(Handle,Items[Index].PPortname,nil,0);
               Messagebox(Handle,Items[Index].pPrinterName,Nil,0);
         End;
 end;
... ¿Y no te sirve con hacer simplemente esto?
Código:
  MiImpresora := String(Items[Index].pPrinterName);
Saludos
Responder Con Cita