IPrintDialogCallback interface (Windows)

Switch View :
ScriptFree
IPrintDialogCallback interface

Applies to: desktop apps only

Provides methods that enable an application to receive notifications and messages from the PrintDlgEx function while the Print Property Sheet is displayed.

When to implement

Implement the IPrintDialogCallback interface if you are using the PrintDlgEx function and want to receive callback notifications and messages. You must implement the interface if you specify a custom dialog box template with application-specific controls. The HandleMessage method enables you to receive messages for the custom dialog box.

When you call PrintDlgEx, you can specify a pointer to your callback object in the lpCallback member of the PRINTDLGEX structure.

Typically, the callback object also contains the IObjectWithSite class. If you specify a callback object, PrintDlgEx calls QueryInterface for both IID_IPrintDialogCallback and IID_IObjectWithSite. If the callback object implements the IObjectWithSite interface, PrintDlgEx calls the IObjectWithSite::SetSite method to pass a pointer to an IPrintDialogServices interface to the application. The IPrintDialogCallback methods can use the IPrintDialogServices interface to retrieve information about the currently selected printer.

When to use

Applications do not call the IPrintDialogCallback methods. The PrintDlgEx function calls the interface methods to pass information to the application.

Members

The IPrintDialogCallback interface inherits from the IUnknown interface. IPrintDialogCallback also has these types of members:

Methods

The IPrintDialogCallback interface has these methods.

MethodDescription
HandleMessage

Called by PrintDlgEx to give your application an opportunity to handle messages sent to the child dialog box in the lower portion of the General page of the Print Property Sheet. The child dialog box contains controls similar to those of the Print dialog box.

InitDone

Called by PrintDlgEx when the system has finished initializing the General page of the Print Property Sheet.

SelectionChange

Called by PrintDlgEx when the user selects a different printer from the list of installed printers on the General page of the Print Property Sheet.

 

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Commdlg.h (include Windows.h)

DLL

Comdlg32.dll

See also

Reference
IPrintDialogServices
PrintDlgEx
PRINTDLGEX

 

 

Send comments about this topic to Microsoft

Build date: 2/10/2012

Community Content

Charles Cotton
IObjectWithSite is Required
From the documentation it may seem like the IObjectWithSite interface is optional and needed only if the caller of PrintDlgEx needs to call any of the IPrintDialogServices functions. In fact, PrintDlgEx will not work correctly if an IPrintDialogCallback handler is specified in PRINTDLGEX::lpCallback, unless the IObjectWithSite implementation is also included, even though the caller may not be using or need the IObjectWithSite::GetSite function to obtain the IPrintDialogServices interface pointer. The problem manifests when you try to print more than one copy. It appears that PrintDlgEx tries to use the IObjectWithSite::GetSite function to obtain access to the IPrintDialogServices interface in order to obtain the current DEVMODE structure, which contains printer driver support information for multiple copies and collation features, among other information. Not being able to obtain the information, PrintDlgEx won't accept a copies value greater than one (1). Actually, having given it a bit more thought, choosing any option on the dialog that requires access to the DEVMODE structure will probably fail in the sense that the DEVMODE structure won't get updated. This is the case on my Windows 7, 64 bit computer. It is probably true on other OS versions, as well, but I cannot be certain.