怎样用Addprinter添加打印机 高分求解

onthewingthewing 2004-11-12 04:49:44
向各位高手请教一个困扰了我几天的一个问题 ,急盼解答!!!!

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

各位高手帮帮忙
...全文
109 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
GGL123 2004-11-12
  • 打赏
  • 举报
回复
up

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧