[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Shell32.dll print : what are the parameters ?

Posted on 2004-10-27
Medium Priority
Last Modified: 2011-09-20

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 ?
Question by:moby59
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 12431240
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.

Author Comment

ID: 12642293
no real answer given :-(

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


Accepted Solution

modulo earned 0 total points
ID: 12663746
PAQed with points refunded (250)

Community Support Moderator

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question