***两台打印机,如果用DELPHI写打印程序,不同按钮调不同打印机打*** 现在程序上的需求是,一个界面上有两个打印按钮,一个USB的,一个串口的,两个打印机都是接在同一台电脑上,不是局域网的.现在客户的要求是点不同的按钮,调用不同的打印机来打印,请问这个怎么实现?我现在急死了,还有三个多小时就要交差了,谁能给段代码我看看呀,这个真是没涉足过的! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 有没有能说说撒,两台都是POST打印机,怎么没人理一下啊 printer里面可以指定系统打印机的 procedure TFormMenuOrder.PrinterSet(PrinterIndex:Integer);//设置打印机varMyHandle : THandle;MyDevice,MyDriver,MyPort: array [0..255] of Char;begin if Printer.PrinterIndex=PrinterIndex then exit; Printer.PrinterIndex := PrinterIndex; Printer.GetPrinter(MyDevice, MyDriver, MyPort, MyHandle); StrCat( MyDevice, ','); StrCat( MyDevice, MyDriver ); StrCat( MyDevice, ','); StrCat( MyDevice, MyPort ); WriteProfileString('WINDOWS','DEVICE',MyDevice ); SendMessage(HWND_BROADCAST,WM_WININICHANGE,0,LongInt(pChar('windows')));end;这个不行啊,在有的电脑上,在程序上一设置默认打印机就死机,在有的程序上不死机,但是报错,有没有别的 POST打印机```貌似USB口的不能打PS:如果是小票的那种的话 PrinterIndex:=PtDecIndex;//设置打印机索引 PTPaperSize(PtDecIndex,DecPaperH,DecPaperW);//设置打印的大小 BeginDoc; Canvas.Font.Name:=DecFontType; //设置字体名称 Canvas.Font.Size:=DecFontSize; //设置字体大小 Canvas.TextOut(DecItemLeft,DecItemTop,Item); Canvas.TextOut(DecItemLeft,DecSerTop,Serialnum); Canvas.TextOut(DecItemLeft,DecDateTop,FormatDateTime( 'mm'+'"/"'+'dd'+'"/"'+'yyyy',date)); EndDoc;设置打印机索引,然后打印。 Delphi中如何检测USB音频设备并控制该音频设备的音量 double和real型有什么区别 winsocket缓冲区有多大? 一个query的问题 怎么样才能用delphi5的SMTP发送要验证身份的邮件? 遇到难题了! 非常感激WnEunfn,请来领昨天晚上的800分!-2 如何调用API 如何在Win2000中结束一个Delphi开发的多层分布式服务器端程服务,彻底清除! 我该怎么另sql语句对数据库的改动立即生效? 晕了.再不解决就没饭碗了..救小弟一命!!! scktsrvr.exe问题
var
MyHandle : THandle;
MyDevice,
MyDriver,
MyPort: array [0..255] of Char;
begin
if Printer.PrinterIndex=PrinterIndex then exit;
Printer.PrinterIndex := PrinterIndex;
Printer.GetPrinter(MyDevice,
MyDriver,
MyPort,
MyHandle);
StrCat( MyDevice, ',');
StrCat( MyDevice, MyDriver );
StrCat( MyDevice, ',');
StrCat( MyDevice, MyPort );
WriteProfileString('WINDOWS','DEVICE',MyDevice );
SendMessage(HWND_BROADCAST,WM_WININICHANGE,0,LongInt(pChar('windows')));end;这个不行啊,在有的电脑上,在程序上一设置默认打印机就死机,在有的程序上不死机,但是报错,有没有别的
PTPaperSize(PtDecIndex,DecPaperH,DecPaperW);//设置打印的大小 BeginDoc;
Canvas.Font.Name:=DecFontType; //设置字体名称
Canvas.Font.Size:=DecFontSize; //设置字体大小
Canvas.TextOut(DecItemLeft,DecItemTop,Item);
Canvas.TextOut(DecItemLeft,DecSerTop,Serialnum);
Canvas.TextOut(DecItemLeft,DecDateTop,FormatDateTime( 'mm'+'"/"'+'dd'+'"/"'+'yyyy',date));
EndDoc;
设置打印机索引,然后打印。