Solved

Shell32.dll print : what are the parameters ?

Posted on 2004-10-27
1,261 Views
Last Modified: 2011-09-20
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
Question by:moby59
    3 Comments
     
    LVL 6

    Expert Comment

    by:Chester_M_Ragel
    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
     

    Author Comment

    by:moby59
    no real answer given :-(

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

    0
     

    Accepted Solution

    by:
    PAQed with points refunded (250)

    modulo
    Community Support Moderator
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Product Review - Android Remix

    Come along for the ride with our Senior Product Manager, Brian Matis, as he reviews the Android Remix.

    Article by: Najam
    Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    877 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now