SftPrintPreview/DLL 2.0

SetControlInfo

Softel vdm, Inc.

The SetControlInfo function defines the Print Preview control attributes.

C

BOOL SftPrintPreview_SetControlInfo(HWND hwnd, LPSFTPRINTPREVIEW_CONTROL lpCtl);

C++

BOOL CSftPrintPreview::SetControlInfo(LPSFTPRINTPREVIEW_CONTROL lpCtl);

Parameters

hwnd

The window handle of the Print Preview control.

lpCtl

A pointer to a SFTPRINTPREVIEW_CONTROL structure  defining the new Print Preview control attributes.  The original contents should be retrieved using the GetControlInfo function.

Returns

The return value is TRUE if the function was successful, false otherwise.

Comments

The SetControlInfo function defines the Print Preview control attributes.

The GetControlInfo function retrieves the Print Preview control attributes.  Some of the structure values returned can be modified and updated using the SetControlInfo function.  See SFTPRINTPREVIEW_CONTROL for more information.

If the SetControlInfo function fails, the SFTPRINTPREVIEW_CONTROL structure's errorValue member contains an error code, indicating which structure member has caused the failure.

Error Code

Invalid SFTPRINTPREVIEW_CONTROL structure member

100

marginX

101

marginY

102

zoom

104

fOwnDevHandles or any fields associated with fOwnDevHandles

107

offsetX

108

offsetY

109

numPageRows 

110

numPageGroups 

111

marginPageGroup 

112

marginShadow 

113

maxPageRows 

114

maxPageGroups 

115

zoomIncrDecr 

116

fltLeftMargin 

117

fltTopMargin 

118

fltRightMargin 

119

fltBottomMargin 

120

fltHeaderFromEdge 

121

fltFooterFromEdge 

122

fltGutterMargin 

123

iUnitsOfMeasure 

124

iPrintPages 

125

iContentSizing 

126

iZoomStyle 

127

hwndContent 

128

hwndData 

Example

C

SFTPRINTPREVIEW_CONTROL Ctl;
Ctl.cbSize = sizeof(SFTPRINTPREVIEW_CONTROL);
if (!SftPrintPreview_GetControlInfo(hwndCtl, &Ctl))
    _ASSERT(0);
// set all desired options
Ctl.numPageRows = 1;                // default to 1x2 pages
Ctl.numPageGroups = 2;
Ctl.zoom = 0;                       // start out with multiple pages
lstrcpy(Ctl.szOutputName, TEXT("SftPrintPreview PreviewPages Sample Output"));
lstrcpy(Ctl.szHeaderRight, TEXT("SftPrintPreview/DLL PreviewPages Sample"));
lstrcpy(Ctl.szFooterLeft, TEXT("www.softelvdm.com"));

if (!SftPrintPreview_SetControlInfo(hwndCtl, &Ctl)) {
    int errorValue = Ctl.errorValue;
    _ASSERT(0); // an error occurred, check errorValue for error code
}

C++

SFTPRINTPREVIEW_CONTROL Ctl;
Ctl.cbSize = sizeof(SFTPRINTPREVIEW_CONTROL);
if (!m_Preview.GetControlInfo(&Ctl))
    _ASSERT(0);
// set all desired options
Ctl.numPageRows = 1;                // default to 1x2 pages
Ctl.numPageGroups = 2;
Ctl.zoom = 0;                       // start out with multiple pages
lstrcpy(Ctl.szOutputName, TEXT("SftPrintPreview RichEdit Output"));
lstrcpy(Ctl.szHeaderRight, TEXT("SftPrintPreview/DLL RichEdit Preview Sample"));
lstrcpy(Ctl.szFooterLeft, TEXT("www.softelvdm.com"));
if (!m_Preview.SetControlInfo(&Ctl)) {
    int errorValue = Ctl.errorValue;
    _ASSERT(0); // an error occurred, check errorValue for error code
}

See Also  C/C++ API  |  C++ Classes  |  Notifications


Feedback / comments / error reports for this topic
© 2016 - Softel vdm, Inc. - www.softelvdm.com