我的思路是
创建InternetApplication对象,用TWebBrowser对象也可以,
使用它的navigate方法打开该文件,调用ExecWB执行打印命令。
可是,打印到文件是需要提供文件名称的,ExecWB的可以接受4个参数,
object.ExecWB(
  cmdID, cmdExecopt, [pvaIn, pvaOut])
设置cmdID 为IDM_PRINT(6)可以打印,设置cmdExecopt=2可以无需用户按按钮,自动进行,但是没有其他参数可以指定打印到什么文件中去。我需要处理上万个这样的文件,该怎么办?

解决方案 »

  1.   

    Syntaxobject.ExecWB( _
        cmdID As OLECMDID, _
        cmdexecopt As OLECMDEXECOPT, _
        [pvaIn As Variant,] _
        [pvaOut As Variant])
    ParameterscmdID
    Long that represents the identifier of the command to execute. For more information on command identifiers, see MSHTML Command Identifiers. 
    cmdexecopt
    OLECMDEXECOPT value that specifies the command options. 
    pvaIn
    Optional. A Variant used for specifying command input arguments. 
    pvaOut
    Optional. A Variant used for specifying command output arguments. 
      

  2.   

    MSDN Home >  MSDN Library >  Programming and Reusing the Browser >  WebBrowser Control >  Reference for Visual Basic Developers > 
    这是MSDN上的资料。
      

  3.   

    你用tprinter和canvas.handle:=getdc(webbrowser.hwnd)试试