Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to start a process with a printto verb AND printer name

4,440 views
Skip to first unread message

Shan McArthur

unread,
May 9, 2003, 6:17:57 PM5/9/03
to
Hello,

I am trying to start a process with the shell and invoke the "printto" verb
but am having difficulties providing the printer destination. I am trying
to print a file to a specific printer from within a .NET application.

I am using System.Diagnostics.Process and have set the
StartInfo.Verb="printto". I have tried unsuccessfully to set the printer
destination in the parameters, and adding it to the verb just throws an
exception. None of the .NET documentation deals with how to do this, and
even the legacy documentation provides no working examples.

The only approach I can think of is to read the registry for the
configuration information for the file's extension, then locate the printto
verb, parse out the command, and launch the process directly. This is
extremely ugly and does not deal with DDE or any other supported shell
extension.

Does anyone have any idea how to invoke the printto verb AND provide a
printer destination?

Thanks,
Shan McArthur


Tian Min Huang

unread,
May 13, 2003, 5:43:40 AM5/13/03
to
Hi,

You can specify the printer name in the ProcessStartInfo.Arguments. I
tested on my side and it works properly:

ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "C:\\CLDMA.LOG";
psi.Verb = "printto";
psi.Arguments="\\\\ComputerName\\PrinterName";
psi.UseShellExecute = true;

Please refer to the following KB article for more information on print
switches:

Description of Print Switches Contained in File Types
http://support.microsoft.com/?id=224961

//Note: Param2 will be stuffed into the %2 placeholder in the arguments
string, etc.
psi.Arguments = "Param2 Param3 Param4";

Hope this helps.

Regards,
HuangTM
This posting is provided "AS IS" with no warranties, and confers no rights.

0 new messages