GreCopyDCLoadData

GreCopyDCLoadData copies the loaded fonts, bit maps, color table, and default attributes from one DC to another.

This function is supported by the graphics engine.

Syntax
GreCopyDCLoadData(hdc, flCmd, hdcSrc, pInstance, lFunction)

Parameters

 * hdc (HDC) - input: Handle of target DC.
 * flCmd (ULONG) - input: Flags indicating which fonts to copy.
 * Valid flags are:
 * LCID_RANGE_GPI - GPI
 * LCID_RANGE_AVIO - AVIO
 * LCID_RANGE_BOTH - GPI and AVIO


 * hdcSrc (HDC) - input:Handle of source DC.
 * pInstance (PVOID) - input:Pointer to instance data.
 * lFunction (ULONG) - input:High-order WORD=flags; low-order WORD=NGreCopyDCLoadData.

Return Code

 * fSuccess (BOOL) - returns:Return codes.
 * On completion, the handling routine must return BOOLEAN (fSuccess).


 * TRUE Successful
 * FALSE Error

Remarks
Device-dependent attributes, such as pick aperture, character cell, and marker cell, are copied only when they have been set by the application. Otherwise, the target device defaults are used.

In response to this call, the graphics engine does the following: The values of the GPI handles in the source DC are preserved. This function fails if the target DC lcid table already has lcids set in the range specified. If the target DC does not support LCOL_REALIZABLE (see GreCreateLogColorTable), a warning (PMERR_REALIZE_NOT_SUPPORTED) is raised and the color table is treated as nonrealizable.
 * Transfers the contents of the source DC's lcid table to the target DC's lcid table.
 * Translates any bit maps when the devices associated with the source and target DCs are different.
 * Calls GreCreateLogicalFont for the target DC, as necessary.
 * Transfers the color table and checks that the resulting color table in the target DC is the same as the one in the source DC.
 * Resets the source DC using GreResetDC. When the save level of the source DC is not 1, it is restored to the default value before GreResetDC is called. The color table is also reset to the default value.

This function has the following effect on fonts:
 * Any logical font in force on the source DC is reloaded onto the target with the original parameters specified by the application.
 * A generic font selected by Match ID can be selected into the target DC provided that it is suitable. For example, an image font cannot be selected for a hardcopy DC.
 * Any device font (selected by Match ID) can be selected for the target DC provided that the new device has a font with the same Match ID. If not, the defaults are used. This is managed by the presentation driver. When it is necessary to use a specific font on the new device, the presentation driver should call GreQueryFonts to determine the characteristics and Match ID of the font for the new device and then to reload it.
 * A warning is raised when it is not possible to reload a font on association (not on reassociation). This warning is one of the following:
 * PMERR_FONT_NOT_LOADED
 * PMERR_KERNING_NOT_SUPPORTED

Refer to the "Error Explanations" section of the Presentation Manager Programming Reference for further explanation.

Example Code

 * 1) define INCL_GRE_LCID
 * 2) include 

HDC     hdc;        /*  Handle of target DC. */ ULONG   flCmd;      /*  Flags indicating which fonts to copy. */ HDC     hdcSrc;     /*  Handle of source DC. */ PVOID   pInstance;  /*  Pointer to instance data. */ ULONG   lFunction;  /*  High-order WORD=flags; low-order WORD=NGreCopyDCLoadData. */ BOOL    fSuccess;   /*  Return codes. */

fSuccess = GreCopyDCLoadData(hdc, flCmd, hdcSrc, pInstance, lFunction); 