Maxim
Wed Feb 16 17:04:45 CST 2005
Since the old days of Windows 3.0 (I remember ExtDeviceMode routine
existing in this OS), the printer settings are allowed to be, say, per-document
in the app like Word. This is sane, since you print particular documents, and
can even keep the printer off between this.
So, the end-user app is given full authority about the printer settings. It
can, say, embed them to the document. The settings you apply in Control Panel
are just the defaults, nothing more. App's "Printer Setup" settings are really
applied to the document.
Microsoft has divided the printer settings to 2 groups. One are standard,
applicable to all printers, like Portrait/Landscape. They are gathered to
DEVMODE structure.
Another are printer-specific and can be any. They are gathered to the tail
of DEVMODE, which has the tail of arbitrary size, and its size is dmDriverExtra
field.
To edit these fields, the printer driver must provide the UI. This UI is
invoked by ExtDeviceMode function in old Win16 and by DocumentProperties in
Win32. In old Win16, the printer driver DLL itself must be loaded and
ExtDeviceMode called from it (IIRC). In Win32, DocumentProperties will load the
printer's UI DLL (defined in the registry) and add its property pages to
standard ones. DocumentProperties will also load the default DEVMODE set from
Control Panel and kept in the registry together with the printer definition.
The printing app usually gets the default DEVMODE on startup and saves it.
Then, when the user invokes File/Printer Setup, DocumentProperties is called to
edit the print settings in this DEVMODE. The DEVMODE (including the
device-dependent tail) can be also saved within the document if this is wanted
so.
When the app prints, this DEVMODE is specified to CreateDC call.
Note: most of this is so since Windows 3.0 (1990).
PPD file for a PostScript printer can define some printer-specific settings
and their ranges. The PS5UI.DLL will interpret them and automatically add the
UI property pages for them. The chosen values of them are put to DEVMODE tail,
and the PSCRIPT5.DLL just prints them to the PostScript stream when the
document is actually printed.
So, invoke DocumentProperties from .NET for printer setttings.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
"Chris Hastings" <chrshstngs@comcast.net> wrote in message
news:642dnc7UosWybI_fRVn-gQ@comcast.com...
> Hi,
> I am desperately trying to find out where the options you select on a
> printer properties screen are stored.
> I have parsed through the PPD file and I have a list of all of the finishing
> options and install options and all of the valid values for each. However,
> I can find just the install options in the registry but I can't find where
> it stores the value for the finishing options.
> For example, on the printer I am looking at, there is an optional install
> for a saddle stitcher, with an option for none or S-501. If I select either
> one, that value is in the PrinterDriverData in the registry. However, for
> finishing options (for example binding) I can select Left Binding and Apply.
> When I go back into the printer properties, the Left Binding option is set.
> So, the question is, where did it store that I selected Left Binding. It is
> not in the PrinterDriverData in the registry. Any idea where the driver
> might save that information so I can get at it?
> I am trying to access this information from a .Net Application. I am using
> the Win32 API's (mostly WinSpool) to get the DevMode and the
> DeviceCapacities and I'm parsing through the PPD to get the device dependent
> options.
> Thanks for your time!
> Chris
>
>