Microsoft KB Archive/89552

= PRB: Metafile Distorted in OLE Client Application =

Article ID: 89552

Article Last Modified on 10/27/1999

-

APPLIES TO


 * Microsoft OLE 1.0

-



This article was previously published under Q89552



SYMPTOMS
When an OLE client application displays an object on certain display devices, the object appears smaller than it does when displayed in the OLE server application. The object appears distorted in the client application.



CAUSE
A metafile is used as the OLE object presentation format. The metafile is distorted because the DPtoLP and LPtoDP functions should use &quot;logical inches&quot; to convert measurement units into the MM_HIMETRIC mapping mode; however, they do not.



RESOLUTION
Rewrite the DPtoLP and LPtoDP functions in the OLE client application to perform the proper metafile scaling. These rewritten functions will not scale bitmaps properly. They should be used only with the metafile presentation format.



MORE INFORMATION
The code below rewrites the DPtoLP and LPtoDP functions to correctly map logical inches into the MM_HIMETRIC mapping mode:
 * 1) define LOGX GetDeviceCaps(hDC, LOGPIXELSX)
 * 2) define LOGY GetDeviceCaps(hDC, LOGPIXELSY)
 * 3) define HIMETRICINCH 2540

void FAR PASCAL MyHiMetrictoDP(HDC hDC, POINT FAR *pt) {  pt.x = MulDiv(pt.x, LOGX, HIMETRICINCH);

// The minus sign is required because the Y axis // points down in the MM_TEXT mapping mode pt.y = -MulDiv(pt.y, LOGY, HIMETRICINCH); }

void FAR PASCAL MyDPtoHiMetric(HDC hDC, POINT FAR *pt) {  pt.x = MulDiv(pt.x, HIMETRICINCH, LOGX);

// The minus sign is required because the Y axis // points down in the MM_TEXT mapping mode pt.y = -MulDiv(pt.y, HIMETRICINCH, LOGY); }

Additional query words: 3.10 1.00

Keywords: KB89552

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.