Black Ice Software
November Developer News
Volume 12, Issue 11 - November, 2007
The BLACK ICE NEWSLETTER is published by Black Ice Software, LLC. The contents of this newsletter in its entirety are Copyright © 2007 by Black Ice Software, LLC. 292 Route 101, Salzburg Square, Amherst, NH 03031, USA. Black Ice Software, LLC. does hereby give permission to reproduce material contained in this newsletter, provided credit is given to the source, and a copy of the publication that the material appears in is sent to Black Ice Software at the above address. Phone: (603) 673-1019 Fax: (603) 672-4112

How to Set Parameters for  the Start Application Feature Programmatically in C#



You can customize the parameter list of the start application feature easily using the SetStartApplicationParamCode method of the BlackIceDEVMODE.ocx. You can pass a maximum of 7 command line arguments to a started application: document name, group file name, printer name, number of pages, multipage, orientation and a custom text parameter. You can enable/disable and set the order of the command line parameters with the SetStartApplicationParamCode method. Every parameter has a code:


document name 1

group file name 2

printer name 3

number of pages 4

multipage 5

orientation 6

customparameter 7


If you want to disable a parameter, the parameter code is the second parameter. If you want to set a parameter’s position in the argument list, the parameter code is the third. It could be a little confusing, but this newsletter should help make it clear.


To disable a parameter (for example document name), you should call the SetStartApplicationParamCode like this:


// 1 : document name (parameter code)

// 0 : disable parameter

BlackIceDEVMODE1.SetStartApplicationParamCode(BlackIceDEVMODE, 1, 0);


To set the second parameter to group file name, you should call the SetStartApplicationParamCode like this:


// 1 : parameter index (zero based integer)

// 2 : group file name (parameter code)

BlackIceDEVMODE1.SetStartApplicationParamCode(BlackIceDEVMODE, 1, 2);


The following C# example demonstrates how to pass a custom text (in this example “test param”) to the start application as the first command line argument, and the printer name as the second parameter:


// Enable pass parameters


// Disable all parameters except custom parameter and printer name

// Document Name

BlackIceDEVMODE1.SetStartApplicationParamCode(pDEVMODE, 1, 0);

// Groupfile Name

BlackIceDEVMODE1.SetStartApplicationParamCode(pDEVMODE, 2, 0);

// Number of pages

BlackIceDEVMODE1.SetStartApplicationParamCode(pDEVMODE, 4, 0);

// Multipage

BlackIceDEVMODE1.SetStartApplicationParamCode(pDEVMODE, 5, 0);

// Orientation

BlackIceDEVMODE1.SetStartApplicationParamCode(pDEVMODE, 6, 0);


// The custom parameter will be the first and the only one

// 0: first parameter, 7: custom parameter

BlackIceDEVMODE1.SetStartApplicationParamCode(pDEVMODE, 0, 7);

// 1 : second parameter index

// 2: Printer name

BlackIceDEVMODE1.SetStartApplicationParamCode(pDEVMODE, 1, 3);

// Set custom parameter

BlackIceDEVMODE1.SetCustomStartAppParameter(pDEVMODE, "test param");