怎样用Addprinter添加打印机 高分求解
向各位高手请教一个困扰了我几天的一个问题 ,急盼解答!!!!
Dim pi2 As PRINTER_INFO_2
Dim di2 As DRIVER_INFO_2
ss = PrinterDriverDirectory '返回打印机驱动路径
strFilePath = "C:\ww" 'Acrobat PDFWriter驱动文件
'放置到打印机驱动路径
FileCopy strFilePath & "\PDFKD.DLL", ss & "\PDFKD.DLL"
FileCopy strFilePath & "\PDFDDUI.DLL", ss & "\PDFDDUI.DLL"
FileCopy strFilePath & "\PDFDDUI.CHS", ss & "\PDFDDUI.CHS"
FileCopy strFilePath & "\PDFDD.DLL", ss & "\PDFDD.DLL"
di3.cVersion = 2
di3.pName = "Acrobat PDFWriter"
di3.pEnvironment = "Windows NT x86"
di3.pDriverPath = ss & "\PDFKD.DLL"
di3.pDataFile = ss & "\PDFKD.DLL"
di3.pConfigFile = ss & "\PDFDDUI.DLL"
di3.pDependentFiles = "PDFDD.DLL " & Chr(0) & "PDFDDUI.CHS " & Chr(0) & Chr(0)
di3.pHelpFile = ""
di3.pMonitorName = ""
di3.pDefaultDataType = "RAW"
p = AddPrinterDriver("", 3, di3)
If p > 0 Then
MsgBox "driver OK"
End If
'程序以上可正确运行 以下部分却不行
pi2.pPrinterName = "Acrobat PDFWriter"
pi2.pPortName = "LPT1:"
pi2.pDriverName = di3.pName
pi2.pDatatype = "RAW"
pi2.pPrintProcessor = "WinPrint"
'pi2.Priority = 1
'pi2.pDevMode
p = AddPrinter("", 2, pi2)
If p > 0 Then
MsgBox "printer OK"
End If
ClosePrinter p
各位高手帮帮忙