leizi_y 发表于 2007-1-8 14:09:00

[求助]批量打印图纸(n多张),送到打印机后,打印机总是随机顺序打印怎么办?

<p>我在网上找了好久,都仅仅是说打印机怎么设置,怎么调整打印顺序的,但没有一个能够满足我的要求,</p><p>我的要求很简单,就是要:先进先出。</p><p>但是找了好久也没有答案。</p><p>希望高手帮帮我。用VB,vba都成</p>

wyj7485 发表于 2007-1-8 14:53:00

<strong>打印机就是按发图先后打印的,如果要调整顺序,就要在发送前完成该操作</strong>

leizi_y 发表于 2007-1-8 15:48:00

<p>我这里不是阿,</p><p>我的打印机设置是:使用后台打印,当我的所有图纸送到后台后(形成了打印列表),真正送到打印机的顺序不是我需要的先进先出顺序,而是随机从打印列表中的东西送给打印机。</p><p>我使用的是Legend LJ7500 PCL5,XP PRO+&nbsp;SP2系统。</p>

wyj7485 发表于 2007-1-8 16:50:00

这应该是程序的问题

leizi_y 发表于 2007-1-8 17:17:00

<p>不可能是程序的问题吧,我采用如下方法调试:</p><p>先将打印机设置成脱机使用,</p><p>然后在将所有打印的东西送到打印机(脱机)中,(可以看到打印列表和我送打印的顺序一致)</p><p>然后再将脱机打印去掉,让系统自动打印,但是这样的后果是:系统不是按照打印列表中的顺序将打印任务送给打印机,而是随机的)</p><p>忘了一点:我的所有打印任务的优先级都是一样,采用默认设置。</p><p>我有几百张图纸,如果系统不按照我的循序打印的话,那么批量处理的意义不大了,因为后期整理图纸将是相当困难的事情。</p>

wyj7485 发表于 2007-1-8 17:43:00

还没遇到过,这是我的设置

leizi_y 发表于 2007-1-9 13:38:00

<p>我明白了,我没有选择"首先打印后台文档"</p><p>谢谢版主的帮助。</p>

leizi_y 发表于 2007-1-19 13:46:00

<p>还想问一下:能不能通过程序直接控制选中"首先打印后台文档"</p><p>而不是通过手动修改的方式。毕竟默认打印机设置中都不选中该选项。</p>

wyj7485 发表于 2007-1-19 14:42:00

<p></p><p><font color="#f70997"><strong>关于打印的API函数参考:</strong></font></p>GetPrintProcessorDirectory&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;GetPrintProcessorDirectory&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"GetPrintProcessorDirectoryA"&nbsp;(ByVal&nbsp;pName&nbsp;As&nbsp;String,&nbsp;ByVal&nbsp;pEnvironment&nbsp;As&nbsp;String,&nbsp;ByVal&nbsp;Level&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;pPrintProcessorInfo&nbsp;As&nbsp;String,&nbsp;ByVal&nbsp;cdBuf&nbsp;As&nbsp;Long,&nbsp;pcbNeeded&nbsp;As&nbsp;Long)&nbsp;As&nbsp;Long&nbsp; <br/>说明&nbsp; <br/>判断指定系统中包含了打印机处理器驱动程序及文件的目录&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>pName&nbsp;String,指定服务器的名字。设置成vbNullString则表示使用本地系统&nbsp; <br/>pEnvironment&nbsp;String,欲在其中获取目录的一个环境(如:Windows&nbsp;NT&nbsp;x86)。用vbNullString表示使用当前(本地)系统环境&nbsp; <br/>Level&nbsp;Long,设为1&nbsp; <br/>pPrintProcessorInfo&nbsp;String,指定一个缓冲区,其中载入打印机处理器目录的完整路径。可定义成ByVal&nbsp;As&nbsp;String,以便将字节数组分配给一个字串,从而取消进行ANSI到Unicode转换的必要&nbsp; <br/>cbBuf&nbsp;Long,pPrintProcessorInfo缓冲区中的字符数量&nbsp; <br/>pcbNeeded&nbsp;Long,指向一个Long型变量的指针,该变量用于保存请求的缓冲区长度,或者实际读入的字节数量&nbsp; <br/><br/><br/>OpenPrinter&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;OpenPrinter&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"OpenPrinterA"&nbsp;(ByVal&nbsp;pPrinterName&nbsp;As&nbsp;String,&nbsp;phPrinter&nbsp;As&nbsp;Long,&nbsp;pDefault&nbsp;As&nbsp;PRINTER_DEFAULTS)&nbsp;As&nbsp;Long&nbsp; <br/>说明&nbsp; <br/>打开指定的打印机,并获取打印机的句柄&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>pPrinterName&nbsp;String,要打开的打印机的名字&nbsp; <br/>phPrinter&nbsp;Long,用于装载打印机的句柄&nbsp; <br/>pDefault&nbsp;PRINTER_DEFAULTS,这个结构保存要载入的打印机信息&nbsp; <br/><br/><br/>PrinterMessageBox&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;PrinterMessageBox&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"PrinterMessageBoxA"&nbsp;(ByVal&nbsp;hPrinter&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;error&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;hwnd&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;pText&nbsp;As&nbsp;String,&nbsp;ByVal&nbsp;pCaption&nbsp;As&nbsp;String,&nbsp;ByVal&nbsp;dwType&nbsp;As&nbsp;Long)&nbsp;As&nbsp;Long&nbsp; <br/>说明&nbsp; <br/>在拥有指定打印作业的系统上显示一个打印机出错消息框。如一名用户在远程登录,这种做法便相当有用&nbsp; <br/>返回值&nbsp; <br/>Long,IDOK,&nbsp;IDRETRY&nbsp;或&nbsp;IDCANCEL;由用户的输入决定(如消息框在远程系统显示,则肯定是IDOK)&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>hPrinter&nbsp;Long,出现错误的打印机的句柄&nbsp; <br/>error&nbsp;Long,ERROR_OUT_OF_PAPER(缺纸)或ERROR_NOT_READY(未就绪)&nbsp; <br/>hwnd&nbsp;Long,指定消息框的父窗口。可以为NULL&nbsp; <br/>pText&nbsp;Long,欲显示的消息正文&nbsp; <br/>pCaption&nbsp;Long,消息框的标题&nbsp; <br/>dwType&nbsp;Long,指定任何一个标准的MessageBox标志。建议使用MB_ICONSTOP&nbsp;或&nbsp;MB_RETRYCANCEL&nbsp;或&nbsp;MB_SETFOREGROUND&nbsp; <br/>适用平台&nbsp; <br/>Windows&nbsp;NT&nbsp; <br/>&nbsp; <br/><br/>PrinterProperties&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;PrinterProperties&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"PrinterProperties"&nbsp;(ByVal&nbsp;hwnd&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;hPrinter&nbsp;As&nbsp;Long)&nbsp;As&nbsp;Long&nbsp; <br/>说明&nbsp; <br/>启动打印机属性对话框,以便对打印机进行配置&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>hwnd&nbsp;Long,对话框的父窗口&nbsp; <br/>hPrinter&nbsp;Long,一个已打开的打印机的句柄&nbsp; <br/>注解&nbsp; <br/>如打印机打开的时候没有使用足够的访问权限,对话框的有些功能也许会禁止使用 <br/>&nbsp; <br/><br/>ReadPrinter&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;ReadPrinter&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"ReadPrinter"&nbsp;(ByVal&nbsp;hPrinter&nbsp;As&nbsp;Long,&nbsp;pBuf&nbsp;As&nbsp;Any,&nbsp;ByVal&nbsp;cdBuf&nbsp;As&nbsp;Long,&nbsp;pNoBytesRead&nbsp;As&nbsp;Long)&nbsp;As&nbsp;Long&nbsp; <br/>说明&nbsp; <br/>从打印机读入数据&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>hPrinter&nbsp;Long,一个已打开的打印机的句柄(用OpenPrinter获得)&nbsp; <br/>pBuf&nbsp;Any,指定一个缓冲区或结构,用于装载来自打印机的数据&nbsp; <br/>cdBuf&nbsp;Long,欲读入的缓冲区大小或字节数&nbsp; <br/>pNoBytesRead&nbsp;Long,用于装载实际读取字节数的一个变量&nbsp; <br/>注解&nbsp; <br/>为使这个函数正常使用,端口必须是双向的 <br/>&nbsp; <br/><br/>ResetDC&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;ResetDC&nbsp;Lib&nbsp;"gdi32"&nbsp;Alias&nbsp;"ResetDCA"&nbsp;(ByVal&nbsp;hdc&nbsp;As&nbsp;Long,&nbsp;lpInitData&nbsp;As&nbsp;DEVMODE)&nbsp;As&nbsp;Long&nbsp; <br/>说明&nbsp; <br/>根据提供的DEVMODE结构,对一个设备场景进行重设。这样便允许我们在打印期间改变打印机的配置。利用这个函数,可将文档中的某个页改为横向打印。可试着用DocumentProperties函数取得一个设备的默认DEVMODE结构&nbsp; <br/>返回值&nbsp; <br/>Long,执行成功则返回设备场景的句柄,零表示失败&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>hdc&nbsp;Long,设备场景的句柄&nbsp; <br/>lpInitData&nbsp;DEVMODE,指定一个缓冲区的第一个字节。该缓冲区包含了用于那个设备的一个有效DEVMODE结构。记住在这个缓冲区中包括设备专用的数据区&nbsp; <br/>注解&nbsp; <br/>这个函数可成功用于由VB的Printer对象的hDC属性返回的设备场景上 <br/>注意一定要正确设置lpdm的dmFields字段 <br/>这个函数在StartPage&nbsp;和&nbsp;EndPage之间会被禁用——即只能在页与页之间调用这个函数,不能在页内调用 <br/>驱动程序、设备和输出端口不可以用这个函数更改 <br/>&nbsp; <br/><br/>ResetPrinter&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;ResetPrinter&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"ResetPrinterA"&nbsp;(ByVal&nbsp;hPrinter&nbsp;As&nbsp;Long,&nbsp;pDefault&nbsp;As&nbsp;PRINTER_DEFAULTS)&nbsp;As&nbsp;Long&nbsp; <br/>说明&nbsp; <br/>改变指定打印机的默认数据类型及文档设置&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>hPrinter&nbsp;Long,欲修改的一台打印机的句柄&nbsp; <br/>pDefault&nbsp;PRINTER_DEFAULTS,定义了打印机新设置的一个结构。参考OpenPrinter函数的说明,了解这个结构进一步的细节。结构中的DesiredAccess字段会被忽略&nbsp; <br/>适用平台&nbsp; <br/>Windows&nbsp;NT <br/>&nbsp; <br/><br/>ScheduleJob&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;ScheduleJob&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"ScheduleJob"&nbsp;(ByVal&nbsp;hPrinter&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;JobId&nbsp;As&nbsp;Long)&nbsp;As&nbsp;Long&nbsp; <br/>说明&nbsp; <br/>提交一个要打印的作业&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>hPrinter&nbsp;Long,一台已打开的打印机句柄&nbsp; <br/>JobId&nbsp;Long,以前用AddJob函数获得的作业编号&nbsp; <br/>注解&nbsp; <br/>参考AddJob函数以获得进一步的信息 <br/>&nbsp; <br/><br/>Setabortproc&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;SetAbortProc&nbsp;Lib&nbsp;"gdi32"&nbsp;Alias&nbsp;"SetAbortProc"&nbsp;(ByVal&nbsp;hDC&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;lpAbortProc&nbsp;As&nbsp;Long)&nbsp;As&nbsp;Long <br/>&nbsp; <br/>说明&nbsp; <br/>&nbsp;&nbsp;该函数叫“取消函数”。它告诉windows是继续打印,还是立即取消。该函数的作用是为windows指定取消函数的地址。由于vb不支持函数的地址概念,所以要使用dwcbk32.ocx通用回调定制控件,否则就不能使用这个函数。&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,SP_ERROR表示失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>lpAbortProc&nbsp;Long,一个取消函数的地址。可用dwcbk32d.ocx定制控件的Procaddress属性或取。&nbsp; <br/>hDC&nbsp;Long&nbsp;,一个设备场景的句柄。&nbsp; <br/><br/><br/>SetForm&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;SetForm&amp;&nbsp;Lib&nbsp;"spoolss.dll"&nbsp;Alias&nbsp;"SetFormA"&nbsp;(ByVal&nbsp;hPrinter&nbsp;As_ <br/>Long,&nbsp;ByVal&nbsp;pFormName&nbsp;As&nbsp;String,&nbsp;ByVal&nbsp;Level&nbsp;As&nbsp;Long,&nbsp;pForm&nbsp;As&nbsp;Byte)&nbsp; <br/>说明&nbsp; <br/>&nbsp;&nbsp;为指定表单设置信息。&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>Level&nbsp;Long,设为1&nbsp; <br/>pForm&nbsp;Byte,包含一个有效FORM_INFO_1结构的缓冲区。&nbsp; <br/>pFormName&nbsp;String,欲设置表单的名字。&nbsp; <br/>hPrinter&nbsp;Long,指定一个打开打印机的句柄(用openprinter取得)&nbsp; <br/>适用平台&nbsp; <br/>windows&nbsp;NT&nbsp; <br/>注解&nbsp; <br/>&nbsp;&nbsp;&nbsp;请参考AddForm函数。 <br/>&nbsp; <br/><br/>SetJob&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;SetJob&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"SetJobA"&nbsp;(ByVal&nbsp;hPrinter&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;JobId&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;Level&nbsp;As&nbsp;Long,&nbsp;pJob&nbsp;As&nbsp;Byte,&nbsp;ByVal&nbsp;Command&nbsp;As&nbsp;Long)&nbsp;As&nbsp;Long <br/>&nbsp; <br/>说明&nbsp; <br/>&nbsp;&nbsp;对一个打印作业的状态进行控制。&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>hPrint&nbsp;Long,指定一个打开打印机的句柄(用openprinter取得)&nbsp; <br/>JobId&nbsp;Long,要修改的作业的编号&nbsp; <br/>Level&nbsp;Long,0,1或2&nbsp; <br/>pJob&nbsp;Byte,指定一个缓冲区。如级别(Level)设为1或2,那该缓冲区就包含了一个JOB_INFO_1或JOB_INFO_2结构。如级别为0,缓冲区为NULL(变成ByVal&nbsp;As&nbsp;Long,以便传递零值)。如指定了一个结构,则来自那个结构的信息会用于改变打印作业的设置(除JobId,pPrinterName,pMachineName,pDriverName,Size,Submitte以及Time字段外)&nbsp; <br/>Command&nbsp;Long,下述常数之一:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>JOB_CONTROL_CANCEL:取消作业&nbsp; <br/>JOB_CONTROL_PAUSE&nbsp;:暂停作业&nbsp; <br/>JOB_CONTROL_RESTART:重新启动一个已开始打印的作业&nbsp; <br/>JOB_CONTROL_RESUME:恢复一个暂停的作业&nbsp; <br/><br/><br/>SetPrinter&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;SetPrinter&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"SetPrinterA"&nbsp;(ByVal&nbsp;hPrinter&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;Level&nbsp;As&nbsp;Long,&nbsp;pPrinter&nbsp;As&nbsp;Byte,&nbsp;ByVal&nbsp;Command&nbsp;As&nbsp;Long)&nbsp;As&nbsp;Long <br/>&nbsp; <br/>说明&nbsp; <br/>对一台打印机的状态进行控制。&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>Level&nbsp;Long,0,2或3(4或5用于windows95,5或6用于NT4.0)。&nbsp; <br/>pPrinter&nbsp;Byte,包含一个PRINTER_INFO_x的结构的缓冲区,其中的x代表级别的设定(Level)。假如级别为零,并且Command设为PRINTER_CONTROL_SET_STATUS,那缓冲区就包含了一个PRINTER_CONTROL_STATUS结构。否则,如级别为零,就设为NULL(要把声明变成ByVal&nbsp;As&nbsp;Long,以便传递零值)&nbsp; <br/>Command&nbsp;Long,下述值之一:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>零,根据PRINTER_INFO_x结构改变打印机&nbsp; <br/>PRINTER_CONTROL_CANCEL:取消作业&nbsp; <br/>PRINTER_CONTROL_PURGE:删除打印机的所有作业&nbsp; <br/>PRINTER_CONTROL_RESUME:惠复一台暂停的打印机&nbsp; <br/>PRINTER_CONTROL_SET_STATUS:载入打印机的PRINTER_CONTROL_STATUS结构(不可NT3.51下使用)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>hPrinter&nbsp;Long,指定一个已打开的打印机的句柄(用openprinter取得)&nbsp; <br/>注解&nbsp; <br/>&nbsp;&nbsp;在PRINTER_INFO_2结构的基础上设置打印机状态时,pServerName,AveragePPM,Status和cJobs字段都会被忽略。 <br/>&nbsp; <br/><br/>SetPrinterData&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;SetPrinterData&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"SetPrinterDataA"&nbsp;(ByVal&nbsp;hPrinter&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;pValueName&nbsp;As&nbsp;String,&nbsp;ByVal&nbsp;dwType&nbsp;As&nbsp;Long,&nbsp;pData&nbsp;As&nbsp;Byte,&nbsp;ByVal&nbsp;cbData&nbsp;As&nbsp;Long)&nbsp;As&nbsp;Long <br/>&nbsp; <br/>说明&nbsp; <br/>&nbsp;&nbsp;设置打印机的注册表配置信息。&nbsp; <br/>返回值&nbsp; <br/>Long,ERROR_SUCCESS表示成功,一个错误值表示失败。&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>hPrinter&nbsp;Long,指定一个已打开的打印机的句柄(用openprinter取得)&nbsp; <br/>pValueName&nbsp;&nbsp;String,欲设置的注册表值名&nbsp; <br/>dwType&nbsp;Long,定义数据的类型,使用来自API32.&nbsp;txt文件的,以REG_起头的一个常数。&nbsp; <br/>pData&nbsp;Byte,指定一个缓冲区的第一个条目,缓冲区中包含了要设置的适当的数据类型&nbsp; <br/>cbData&nbsp;Long,缓冲区pData的长度&nbsp; <br/><br/><br/>StartDoc&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;StartDoc&nbsp;Lib&nbsp;"gdi32"&nbsp;Alias&nbsp;"StartDocA"&nbsp;(ByVal&nbsp;hdc&nbsp;As&nbsp;Long,&nbsp;lpdi&nbsp;As&nbsp;DOCINFO)&nbsp;As&nbsp;Long <br/>&nbsp; <br/>说明&nbsp; <br/>&nbsp;&nbsp;&nbsp;开始一个打印作业。&nbsp; <br/>返回值&nbsp; <br/>Long,如执行成功,返回文档的作业编号,常数SP_ERROR失败。会设置GetLastError&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>ipdi&nbsp;DOCINFO,对文档定义的一个结构&nbsp; <br/>hdc&nbsp;Long,设备场景的句柄&nbsp; <br/>cbSize&nbsp;Long,结构的大小,目前是12个字节&nbsp; <br/>lpszDocName&nbsp;String,指向一个字串的指针,该字串包含了文档名。这个文档名会在打印管理程序中显示出来&nbsp; <br/>lpszOutput&nbsp;String,指向一个字串的指针,该字串包含了输出文件的名字。可设为vbNullString。表示将输出结果传送到设备&nbsp; <br/>注解&nbsp; <br/>&nbsp;&nbsp;&nbsp;对DOCINFO结构的定义如下: <br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type&nbsp;DOCINFO <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cbSize&nbsp;As&nbsp;Long <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lpszDocName&nbsp;As&nbsp;String <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lpszOutput&nbsp;As&nbsp;String <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Type <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp; <br/><br/>StartDocPrinter&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;StartDocPrinter&nbsp;Lib&nbsp;"winspool.drv"&nbsp;Alias&nbsp;"StartDocPrinterA"&nbsp;(ByVal&nbsp;hPrinter&nbsp;As&nbsp;Long,&nbsp;ByVal&nbsp;Level&nbsp;As&nbsp;Long,&nbsp;pDocInfo&nbsp;As&nbsp;Byte)&nbsp;As&nbsp;Long <br/>&nbsp; <br/>说明&nbsp; <br/>&nbsp;&nbsp;在后台打印的级别启动一个新文档。&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>hPrinter&nbsp;Long,指定一个已打开的打印机的句柄(用openprinter取得)&nbsp; <br/>Level&nbsp;Long,1或2(仅用于win95)&nbsp; <br/>pDocInfo&nbsp;Byte,包含一个DOC_INFO_1或DOC_INFO_2结构得缓冲区&nbsp; <br/>注解&nbsp; <br/>&nbsp;&nbsp;在应用程序的级别并非有用。后台打印程序用它标识一个文档的开始 <br/>&nbsp; <br/><br/>StartPage&nbsp; <br/><br/>VB声明&nbsp; <br/>Declare&nbsp;Function&nbsp;StartPage&nbsp;Lib&nbsp;"gdi32"&nbsp;Alias&nbsp;"StartPage"&nbsp;(ByVal&nbsp;hdc&nbsp;As&nbsp;Long)&nbsp;As&nbsp;Long <br/>&nbsp; <br/>说明&nbsp; <br/>&nbsp;&nbsp;打印一个新页前要先调用这个函数。&nbsp; <br/>返回值&nbsp; <br/>Long,非零表示成功,零表示失败。&nbsp; <br/>参数表&nbsp; <br/>参数&nbsp;类型及说明&nbsp; <br/>hdc&nbsp;Long,一个设备场景的句柄&nbsp; <br/>注解&nbsp; <br/>&nbsp;&nbsp;&nbsp;参考EndPage函数的“移植问题” <br/>

sanjie 发表于 2008-4-13 14:50:00

学习一下
页: [1]
查看完整版本: [求助]批量打印图纸(n多张),送到打印机后,打印机总是随机顺序打印怎么办?