放弃 (100分)

  • 主题发起人 主题发起人 XWHope
  • 开始时间 开始时间
X

XWHope

Unregistered / Unconfirmed
GUEST, unregistred user!
放弃
谢谢参与朋友!
 

procedure SetDefaultPrinter2K(PrinterName: String);
var
I: Integer;
Device : PChar;
Driver : Pchar;
Port : Pchar;
HdeviceMode: Thandle;
aPrinter : TPrinter;
begin
Printer.PrinterIndex := -1;
getmem( device, 255);
getmem( Driver, 255);
getmem( Port, 255);
aPrinter := TPrinter.create;
for I := 0 to Printer.printers.Count-1do
begin
if pos(uppercase(PrinterName),uppercase(Printer.printers)) >0 then
begin
aprinter.printerindex := i;
aPrinter.getprinter( device, driver, port, HdeviceMode);
StrCat(Device, ',');
StrCat(Device, Driver );
StrCat(Device, Port );
WriteProfileString('windows', 'device', Device );
StrCopy( Device, 'windows' );
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, Longint(@Device));
end;
end;
freemem( device, 255);
freemem( Driver, 255);
freemem( Port, 255);
aPrinter.free;
end;
 
控制面板-打印机
选中你要用的打印机点击右键,选择“打印首选项”,点击“基本”选项卡 这里可以选择打印方向
点击“纸张”选项卡,可以选择纸张大小
http://www.delphibbs.com/delphibbs/dispq.asp?lid=629842
 
多人接受答案了。
 
后退
顶部