• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1454
  • Last Modified:

Shell32.dll print : what are the parameters ?


I need to print a prdf file without human intervention... so i did the following program in c# :

private static extern int ShellExecuteA(IntPtr hwnd,string operation,string file,string paramters,string directory,int showcmd);
string fichier_local = @"d:\csharp\toto.pdf" ;
if (fichier_local != null) ShellExecuteA(IntPtr.Zero, "print", fichier_local, null, null, 0);

it works like a charm, but it prints to the default printer, and the default tray.
I need to specify the printer and more important the tray.

In fact the program has to print 3 pdf files,
- one using normal paper tray 1,
- one using special paper in tray 2
- one using another paper in tray 3

Could you help me ?
1 Solution
This may help you..

I Don't have any experience with this. Anyway I'm sure that you must specify the printer and tray in  

ShellExecuteA(IntPtr.Zero, "print", fichier_local, null, null, 0);

It must be the 1st parameter. The first parameter must be changed and you must pass the handle to the printer which you want to printer.
moby59Author Commented:
no real answer given :-(

I made a VB6 program and changed the default system printer, then print, then change the default printer...

PAQed with points refunded (250)

Community Support Moderator
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now