PrintPocketCE Command Line
Support
Special
Developer License Pricing
PrintPocketCE can be used with eVC's CreateProcess()
command-line support method allow Pocket PC applications to use PrintPocketCE
for printing Pocket Word, RTF and plain text files behind the scenes. Direct email printing from the command-line is not currently
supported. Any or all of the following parameters may be passed via
command-line. Note: eVB does not offer a
CreateProcess() method for command line support.
Supported command-line parameters are:
/F<filename> - Passes full path and
file name of document to be printed - this parameter must be a
Pocket Word, Rich Text or plain text file.
/Q - Specifies "QuickPrint" to
bypass Select Printer dialog
/P - Specifies "Plain Text" to
print out Pocket Word and RTF using plain text
/R<registration code> - Passes
PrintPocketCE registration code to enable PrintPocketCE to print in
full non-evaluation mode.
/E - Returns extended error codes (see Return
Values discussion below)
/I - Forces PrintPocketCE to start with Inbox
Email display list.
/W - Forces PrintPocketCE to start with
Word/Doc display list.
------------------ Pocket Excel Options
----------------
/A<filename> - Passes full path and
file name of Pocket Excel (PXL) spreadsheet to be printed.
/X - Forces PrintPocketCE to start with
Pocket Excel display
/XAn - Excel Print Area: 0="Full
Spreadsheet", 1="Selection", 2="Populated",
3="Custom"
/XAFn - Custom print area "From"
cell
/XATn - Custom print area "To" cell
/XSn - Sheet to print (0-9)
/XZn - Print Sizing: 0="Normal -
100%", 1="Fit to Page", 2="Custom"
/XZCn - Print sizing Custom percentage : 25 -
250 (%)
/XHn - Include Row & Column headings
(1=TRUE, 0=FALSE)
/XGn - Include gridlines (1=TRUE, 0=FALSE)
/XBn - Include background colors (1=TRUE,
0=FALSE)
/XCn - Center spreadsheet (1=TRUE, 0=FALSE)
/XQ - Skip Excel options screen (Note: Use /XQ
and /Q to skip all setup dialogs. /XQ can be used without /Q but if
/XQ is not used, /Q will be ignored, since user can select quick
print at Excel options screen.
Return Values: Use the "GetExitCodeProcess()"
function (see example below) to determine if PrintPocketCE was
successful in printing. Normally returns 0 for Error or 1 for
Success. If /E option (extended error code) is passed in
command-line, then GetExitCodeProcess() returns error codes
equivalent to those returned by GetLastError() function, including
the following:
Example: the following is C code that uses
CreateProcess() to invoke PrintPocketCE to print out the document
"ActiveSync EULA.psw". The /Q parameter specifies
QuickPrint mode to go directly to printing.
PROCESS_INFORMATION pi;
//Start up PrintPocketCE and pass filename and set QuickPrint
mode
bval=CreateProcess(
_T("\\Program
Files\\PrintPocketCE\\PrintPocketCE.exe"),
_T("/Q /F \\My
Documents\\Hello.psw"),
NULL,NULL,FALSE,0, NULL, NULL, NULL, &pi);
if (bval==0) {
//Error starting PrintPocketCE
dval=GetLastError();
}
else {
// Lets wait until PrintPocketCE
finishes printing
CloseHandle(pi.hThread);
WaitForSingleObject(pi.hProcess, INFINITE);
//PrintPocketCE is done... lets see
if it was successful
DWORD dwExit;
GetExitCodeProcess(pi.hProcess, &dwExit);
if (dwExit==0) {
//Handle
error
}
CloseHandle(pi.hProcess);
}
If you wanted to print a Pocket Excel spreadsheet, you could
replace the CreateProcess call above with the following:
bval=CreateProcess(
_T("\\Program Files\\PrintPocketCE\\PrintPocketCE.exe"),
_T("/Q /XQ /XA0 /XS0
/XZ1 /XH1 /XG0 /XB1 /XC1
/A \\My Documents\\Invoice.pxl"),
NULL,NULL,FALSE,0, NULL, NULL, NULL, &pi);