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

Shell32.dll print : what are the parameters ?

Hi

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

[DllImport("shell32.dll")]
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 ?
0
moby59
Asked:
moby59
1 Solution
 
Chester_M_RagelCommented:
This may help you..
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21012246.html

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.
0
 
moby59Author Commented:
no real answer given :-(

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

0
 
moduloCommented:
PAQed with points refunded (250)

modulo
Community Support Moderator
0
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