现在程序上的需求是,一个界面上有两个打印按钮,一个USB的,一个串口的,两个打印机都是接在同一台电脑上,不是局域网的.现在客户的要求是点不同的按钮,调用不同的打印机来打印,请问这个怎么实现?我现在急死了,还有三个多小时就要交差了,谁能给段代码我看看呀,这个真是没涉足过的!

解决方案 »

  1.   

    有没有能说说撒,两台都是POST打印机,怎么没人理一下啊
      

  2.   

    printer里面可以指定系统打印机的
      

  3.   

    procedure TFormMenuOrder.PrinterSet(PrinterIndex:Integer);//设置打印机
    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;这个不行啊,在有的电脑上,在程序上一设置默认打印机就死机,在有的程序上不死机,但是报错,有没有别的
      

  4.   

    POST打印机```貌似USB口的不能打PS:如果是小票的那种的话
      

  5.   

            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;
    设置打印机索引,然后打印。