关于打印的问题,改变默认打印机 printer.printerindex:=nqrPublic.PrinterSettings.PrinterIndex:=printer.PrinterIndex; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在窗体中加入combobox和两个button你自己TRY!我测试通过!procedure TForm1.Button1Click(Sender: TObject);begin ComboBox1.Items := Printer.Printers; {populates ComboBox} ComboBox1.ItemIndex := Printer.PrinterIndex; {sets display to current printer}end;procedure TForm1.Button2Click(Sender: TObject);var Device: array[0..255] of Char; Driver: array[0..255] of char; Port: array[0..255] of char; s : array[0..255] of Char; hDeviceMode: THandle;begin Printer.PrinterIndex := ComboBox1.ItemIndex; Printer.GetPrinter (Device, Driver, Port, hDeviceMode); StrCopy (s, Device); StrCat (s, ','); StrCat (s, Driver); StrCat (s, ','); StrCat (s, Port); WriteProfileString ('windows', 'device', s); StrCopy (s, 'windows'); SendMessage (HWND_BROADCAST, WM_WININICHANGE, 0, LongInt(@s));end; SetPrinter函数(see in PRINTER.PAS unit). dbchart Y坐标的设置 如何用delphi6或7调用delphi2005做的WebService? 其实是这样,见代码 关于DCOMConnection的ServerName的问题。 用DBxpress怎么调用SQL Server下的存储过程啊! delphi菜鸟提问2: 請談談看法!關于工資管理 (涡轮超人)请进! 菜鸟的烦恼之消息投递篇(100) ado的dataset为什么不能正常的close 最后20分了...怎么刷新form?? 大家进来看看这段代码错在哪里?
你自己TRY!
我测试通过!procedure TForm1.Button1Click(Sender: TObject);
begin
ComboBox1.Items := Printer.Printers; {populates ComboBox}
ComboBox1.ItemIndex := Printer.PrinterIndex; {sets display to current printer}
end;procedure TForm1.Button2Click(Sender: TObject);
var
Device: array[0..255] of Char;
Driver: array[0..255] of char;
Port: array[0..255] of char;
s : array[0..255] of Char;
hDeviceMode: THandle;begin Printer.PrinterIndex := ComboBox1.ItemIndex;
Printer.GetPrinter (Device, Driver, Port, hDeviceMode);
StrCopy (s, Device);
StrCat (s, ',');
StrCat (s, Driver);
StrCat (s, ',');
StrCat (s, Port);
WriteProfileString ('windows', 'device', s);
StrCopy (s, 'windows');
SendMessage (HWND_BROADCAST, WM_WININICHANGE, 0, LongInt(@s));end;