1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Printers;
type TForm1 = class(TForm) Label1: TLabel; ListBox1: TListBox; procedure FormCreate(Sender: TObject); private public end;
var Form1: TForm1;
implementation
{$R *.dfm}
function GetDefaultPrinter: string; var ResStr: array[0..255] of Char; begin GetProfileString('Windows', 'device', '', ResStr, 255); Result := StrPas(ResStr); end;
procedure TForm1.FormCreate(Sender: TObject); begin Label1.Caption:= GetDefaultPrinter; listbox1.items := printer.printers; end;
end. |