首先:每个线程打印的时候要用的打印机的名称你要知道然后通过Printers单元里面的Printervar sDeviceName, sOutput: string;hCardDC: HDC;
di:do
CINFO;
begin
for i:=0 to Printer.Printers.count-1do
begin
sDeviceName := Printer.Printers;
if sDeviceName ='你想用的打印机名称' then
break;
end;
hCardDC := CreateDC('', Pchar(sDeviceName), Pchar(sOutput), nil);//选择打印机 if hCardDC <> 0 then
begin
//操作打印机 di.cbSize := sizeof(di);
di.lpszDocName := 'DocName';
di.lpszOutput := nil;
di.lpszDatatype := nil;
di.fwType := 0;
if (StartDoc(hCardDC, di) <> SP_ERROR) then
begin
// /* Start page */ if (StartPage(hCardDC) > 0) then
begin
...... EndDoc(hCardDC);
end;