Printer.PrinterIndex := 0; // 1
解决方案 »
- 如何将客户机的*.txt文件导入服务器的sql server数据库
- http://mirdy.cn/add.asp?action=sfadd
- 关于fastreport问题,请教高手!!!!!!!!!!!!!!!!!!
- 俺!急!急!!急!朋友请近来瞧一瞧!!
- Pascal语法问题
- 建立了一个form,加入了project里,为什么一运行这个project就显示这个form?
- 读文件流到String,出现的错误
- 我是菜鸟想请教各位大侠一点问题,望多指教
- 数据库的备份和还原
- 请问在DBMemo中能实现 象Uedit8.10b里的 跟着光标移动的黄色长条吗?
- 在Win2000系统下,用程序怎样设置默认打印机。
- 怎样用程序实现设置默认打印机
在窗体中加入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;