问题
I am currently trying to print a HTML file using mshtml.dll. Looking up in the registry I found for html-files, the following print-to entry:
"%systemroot%\system32\rundll32.exe"
"%systemroot%\system32\mshtml.dll",PrintHTML "%1" "%2" "%3" "%4"
Unexpectedly there are some parameters to pass to mshtml.dll, what are the parameters of mshtml.dll (numbered %1, %2, %3, %4 in this registry information)?
回答1:
You found this in the printto verb of the htmlfile progid. Which runs when you drag an HTML file from Explorer and drop it on a printer shortcut. The printto verb has these arguments:
%1: the path to the HTML file
%2: the printer name
%3: the printer driver name (optional)
%4: the printer port name (optional)
Taking a dependency on an undocumented function is unwise, you can't rely on this still working in the next Windows version. Using WebBrowser.Print() is the documented way. IWebBrowser2::ExecWB() in native code.
来源:https://stackoverflow.com/questions/19981020/what-parameters-to-pass-to-mshtml-dll