MCPcopy Create free account
hub / github.com/LegacyUpdate/LegacyUpdate / GetExtent

Method GetExtent

include/com/IViewObjectExImpl.h:59–86  ·  view source on GitHub ↗

IViewObject2

Source from the content-addressed store, hash-verified

57
58 // IViewObject2
59 STDMETHODIMP GetExtent(DWORD dwAspect, LONG lindex, DVTARGETDEVICE *ptd, LPSIZEL lpsizel) {
60 if (lpsizel == NULL) {
61 return E_POINTER;
62 }
63
64 if (dwAspect != DVASPECT_CONTENT) {
65 return DV_E_DVASPECT;
66 }
67
68 if (!this->m_pParent->m_innerHwnd) {
69 lpsizel->cx = 0;
70 lpsizel->cy = 0;
71 return E_FAIL;
72 }
73
74 RECT rect;
75 GetClientRect(this->m_pParent->m_innerHwnd, &rect);
76
77 // Convert to HIMETRIC
78 HDC hdc = GetDC(NULL);
79 int ppiX = GetDeviceCaps(hdc, LOGPIXELSX);
80 int ppiY = GetDeviceCaps(hdc, LOGPIXELSY);
81 ReleaseDC(NULL, hdc);
82
83 lpsizel->cx = MAP_PIX_TO_LOGHIM(rect.right - rect.left, ppiX);
84 lpsizel->cy = MAP_PIX_TO_LOGHIM(rect.bottom - rect.top, ppiY);
85 return S_OK;
86 }
87
88 // IViewObjectEx
89 STDMETHODIMP GetRect(DWORD dwAspect, LPRECTL pRect) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected