A
aerobull
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TsetDefaultPrinterDlg.setDefaultBtnClick(Sender: TObject);<br>var<br> PrinterName: array[0..255] of Char;<br> phPrinter: tHandle; <br> lpbPrinter: PPrinterInfo5; <br> port: string;<br> aPort: array[0..255] of char;<br>begin<br> strPCopy(PrinterName, printersLB.items[printersLB.itemIndex]);<br> if (openPrinter(PrinterName, phPrinter, nil)) then<br> begin<br> port := winIniFile.readString('devices', printersLB.items[printersLB.itemIndex], 'LPT1:');<br> port := copy(port, pos(',', port) + 1, length(port));<br> strPCopy(aPort, port);<br> lpbPrinter.pPrinterName := PrinterName; //此处开始出错。<br> lpbPrinter.pPortName := aPort; <br> lpbPrinter.Attributes := PRINTER_ATTRIBUTE_DEFAULT; <br> setPrinter(phPrinter, 5, lpbPrinter, 0);<br> end<br> else<br> messageDlg('Printer context not opened', mtError, [mbOK], 0);<br> currentPrinter.text := winIniFile.readString('windows', 'device', 'None Selected');<br>end;<br>各位,邦个忙。<br><br>thx<br>