1
0

afxctl.h 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969
  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. /////////////////////////////////////////////////////////////////////////////
  11. // AFXCTL.H - MFC OLE Control support
  12. #ifndef __AFXCTL_H__
  13. #define __AFXCTL_H__
  14. // make sure afxole.h is included first
  15. #ifndef __AFXOLE_H__
  16. #include <afxole.h>
  17. #endif
  18. #ifdef _AFX_MINREBUILD
  19. #pragma component(minrebuild, off)
  20. #endif
  21. #ifndef _AFX_FULLTYPEINFO
  22. #pragma component(mintypeinfo, on)
  23. #endif
  24. /////////////////////////////////////////////////////////////////////////////
  25. // Classes declared in this file
  26. //CWinApp
  27. class COleControlModule; // Module housekeeping for an .OCX
  28. class CFontHolder; // For manipulating font objects
  29. class CPictureHolder; // For manipulating picture objects
  30. //CWnd
  31. class COleControl; // OLE Control
  32. //CDialog
  33. class COlePropertyPage; // OLE Property page
  34. class CStockPropPage;
  35. class CColorPropPage;
  36. class CFontPropPage;
  37. class CPicturePropPage;
  38. class CPropExchange; // Abstract base for property exchange
  39. //CAsyncMonikerFile
  40. class CDataPathProperty; // Asynchronous properties for OLE Controls
  41. class CCachedDataPathProperty; // Cached asynchronous properties for OLE Controls
  42. /////////////////////////////////////////////////////////////////////////////
  43. // Set structure packing
  44. #ifdef _AFX_PACKING
  45. #pragma pack(push, _AFX_PACKING)
  46. #endif
  47. /////////////////////////////////////////////////////////////////////////////
  48. // MFC data definition for data exported from the runtime DLL
  49. #undef AFX_DATA
  50. #define AFX_DATA AFX_OLE_DATA
  51. /////////////////////////////////////////////////////////////////////////////
  52. // COleControlModule - base class for .OCX module
  53. // This object is statically linked into the control.
  54. class COleControlModule : public CWinApp
  55. {
  56. DECLARE_DYNAMIC(COleControlModule)
  57. public:
  58. virtual BOOL InitInstance();
  59. virtual int ExitInstance();
  60. };
  61. /////////////////////////////////////////////////////////////////////////////
  62. // Module state macro
  63. #define AfxGetControlModuleContext AfxGetStaticModuleState
  64. #define _afxModuleAddrThis AfxGetStaticModuleState()
  65. /////////////////////////////////////////////////////////////////////////////
  66. // Connection helper functions
  67. BOOL AFXAPI AfxConnectionAdvise(LPUNKNOWN pUnkSrc, REFIID iid,
  68. LPUNKNOWN pUnkSink, BOOL bRefCount, DWORD* pdwCookie);
  69. BOOL AFXAPI AfxConnectionUnadvise(LPUNKNOWN pUnkSrc, REFIID iid,
  70. LPUNKNOWN pUnkSink, BOOL bRefCount, DWORD dwCookie);
  71. /////////////////////////////////////////////////////////////////////////////
  72. // Event maps
  73. enum AFX_EVENTMAP_FLAGS
  74. {
  75. afxEventCustom = 0,
  76. afxEventStock = 1,
  77. };
  78. struct AFX_EVENTMAP_ENTRY
  79. {
  80. AFX_EVENTMAP_FLAGS flags;
  81. DISPID dispid;
  82. LPCTSTR pszName;
  83. LPCSTR lpszParams;
  84. };
  85. struct AFX_EVENTMAP
  86. {
  87. const AFX_EVENTMAP* lpBaseEventMap;
  88. const AFX_EVENTMAP_ENTRY* lpEntries;
  89. DWORD* lpStockEventMask;
  90. };
  91. #define DECLARE_EVENT_MAP() \
  92. private: \
  93. static const AFX_DATA AFX_EVENTMAP_ENTRY _eventEntries[]; \
  94. static DWORD _dwStockEventMask; \
  95. protected: \
  96. static const AFX_DATA AFX_EVENTMAP eventMap; \
  97. virtual const AFX_EVENTMAP* GetEventMap() const;
  98. #define BEGIN_EVENT_MAP(theClass, baseClass) \
  99. const AFX_EVENTMAP* theClass::GetEventMap() const \
  100. { return &eventMap; } \
  101. const AFX_DATADEF AFX_EVENTMAP theClass::eventMap = \
  102. { &(baseClass::eventMap), theClass::_eventEntries, \
  103. &theClass::_dwStockEventMask }; \
  104. AFX_COMDAT DWORD theClass::_dwStockEventMask = (DWORD)-1; \
  105. AFX_COMDAT const AFX_DATADEF AFX_EVENTMAP_ENTRY theClass::_eventEntries[] = \
  106. {
  107. #define END_EVENT_MAP() \
  108. { afxEventCustom, DISPID_UNKNOWN, NULL, NULL }, \
  109. };
  110. #define EVENT_CUSTOM(pszName, pfnFire, vtsParams) \
  111. { afxEventCustom, DISPID_UNKNOWN, _T(pszName), vtsParams },
  112. #define EVENT_CUSTOM_ID(pszName, dispid, pfnFire, vtsParams) \
  113. { afxEventCustom, dispid, _T(pszName), vtsParams },
  114. #define EVENT_PARAM(vtsParams) (BYTE*)(vtsParams)
  115. /////////////////////////////////////////////////////////////////////////////
  116. // Stock events
  117. #define EVENT_STOCK_CLICK() \
  118. { afxEventStock, DISPID_CLICK, _T("Click"), VTS_NONE },
  119. #define EVENT_STOCK_DBLCLICK() \
  120. { afxEventStock, DISPID_DBLCLICK, _T("DblClick"), VTS_NONE },
  121. #define EVENT_STOCK_KEYDOWN() \
  122. { afxEventStock, DISPID_KEYDOWN, _T("KeyDown"), VTS_PI2 VTS_I2 },
  123. #define EVENT_STOCK_KEYPRESS() \
  124. { afxEventStock, DISPID_KEYPRESS, _T("KeyPress"), VTS_PI2 },
  125. #define EVENT_STOCK_KEYUP() \
  126. { afxEventStock, DISPID_KEYUP, _T("KeyUp"), VTS_PI2 VTS_I2 },
  127. #define EVENT_STOCK_MOUSEDOWN() \
  128. { afxEventStock, DISPID_MOUSEDOWN, _T("MouseDown"), \
  129. VTS_I2 VTS_I2 VTS_XPOS_PIXELS VTS_YPOS_PIXELS },
  130. #define EVENT_STOCK_MOUSEMOVE() \
  131. { afxEventStock, DISPID_MOUSEMOVE, _T("MouseMove"), \
  132. VTS_I2 VTS_I2 VTS_XPOS_PIXELS VTS_YPOS_PIXELS },
  133. #define EVENT_STOCK_MOUSEUP() \
  134. { afxEventStock, DISPID_MOUSEUP, _T("MouseUp"), \
  135. VTS_I2 VTS_I2 VTS_XPOS_PIXELS VTS_YPOS_PIXELS },
  136. #define EVENT_STOCK_ERROREVENT() \
  137. { afxEventStock, DISPID_ERROREVENT, _T("Error"), \
  138. VTS_I2 VTS_PBSTR VTS_SCODE VTS_BSTR VTS_BSTR VTS_I4 VTS_PBOOL },
  139. #define EVENT_STOCK_READYSTATECHANGE() \
  140. { afxEventStock, DISPID_READYSTATECHANGE, _T("ReadyStateChange"), \
  141. VTS_I4 },
  142. // Shift state values for mouse and keyboard events
  143. #define SHIFT_MASK 0x01
  144. #define CTRL_MASK 0x02
  145. #define ALT_MASK 0x04
  146. // Button values for mouse events
  147. #define LEFT_BUTTON 0x01
  148. #define RIGHT_BUTTON 0x02
  149. #define MIDDLE_BUTTON 0x04
  150. /////////////////////////////////////////////////////////////////////////////
  151. // Stock properties
  152. #define DISP_PROPERTY_STOCK(theClass, szExternalName, dispid, pfnGet, pfnSet, vtPropType) \
  153. { _T(szExternalName), dispid, NULL, vtPropType, \
  154. (AFX_PMSG)(void (theClass::*)(void))&pfnGet, \
  155. (AFX_PMSG)(void (theClass::*)(void))&pfnSet, 0, afxDispStock }, \
  156. #define DISP_STOCKPROP_APPEARANCE() \
  157. DISP_PROPERTY_STOCK(COleControl, "Appearance", DISPID_APPEARANCE, \
  158. COleControl::GetAppearance, COleControl::SetAppearance, VT_I2)
  159. #define DISP_STOCKPROP_BACKCOLOR() \
  160. DISP_PROPERTY_STOCK(COleControl, "BackColor", DISPID_BACKCOLOR, \
  161. COleControl::GetBackColor, COleControl::SetBackColor, VT_COLOR)
  162. #define DISP_STOCKPROP_BORDERSTYLE() \
  163. DISP_PROPERTY_STOCK(COleControl, "BorderStyle", DISPID_BORDERSTYLE, \
  164. COleControl::GetBorderStyle, COleControl::SetBorderStyle, VT_I2)
  165. #define DISP_STOCKPROP_CAPTION() \
  166. DISP_PROPERTY_STOCK(COleControl, "Caption", DISPID_CAPTION, \
  167. COleControl::GetText, COleControl::SetText, VT_BSTR)
  168. #define DISP_STOCKPROP_ENABLED() \
  169. DISP_PROPERTY_STOCK(COleControl, "Enabled", DISPID_ENABLED, \
  170. COleControl::GetEnabled, COleControl::SetEnabled, VT_BOOL)
  171. #define DISP_STOCKPROP_FONT() \
  172. DISP_PROPERTY_STOCK(COleControl, "Font", DISPID_FONT, \
  173. COleControl::GetFont, COleControl::SetFont, VT_FONT)
  174. #define DISP_STOCKPROP_FORECOLOR() \
  175. DISP_PROPERTY_STOCK(COleControl, "ForeColor", DISPID_FORECOLOR, \
  176. COleControl::GetForeColor, COleControl::SetForeColor, VT_COLOR)
  177. #define DISP_STOCKPROP_HWND() \
  178. DISP_PROPERTY_STOCK(COleControl, "hWnd", DISPID_HWND, \
  179. COleControl::GetHwnd, SetNotSupported, VT_HANDLE)
  180. #define DISP_STOCKPROP_TEXT() \
  181. DISP_PROPERTY_STOCK(COleControl, "Text", DISPID_TEXT, \
  182. COleControl::GetText, COleControl::SetText, VT_BSTR)
  183. #define DISP_STOCKPROP_READYSTATE() \
  184. DISP_PROPERTY_STOCK(COleControl, "ReadyState", DISPID_READYSTATE, \
  185. COleControl::GetReadyState, SetNotSupported, VT_I4)
  186. /////////////////////////////////////////////////////////////////////////////
  187. // Stock methods
  188. #define DISP_FUNCTION_STOCK(theClass, szExternalName, dispid, pfnMember, vtRetVal, vtsParams) \
  189. { _T(szExternalName), dispid, vtsParams, vtRetVal, \
  190. (AFX_PMSG)(void (theClass::*)(void))&pfnMember, (AFX_PMSG)0, 0, \
  191. afxDispStock }, \
  192. #define DISP_STOCKFUNC_REFRESH() \
  193. DISP_FUNCTION_STOCK(COleControl, "Refresh", DISPID_REFRESH, \
  194. COleControl::Refresh, VT_EMPTY, VTS_NONE)
  195. #define DISP_STOCKFUNC_DOCLICK() \
  196. DISP_FUNCTION_STOCK(COleControl, "DoClick", DISPID_DOCLICK, \
  197. COleControl::DoClick, VT_EMPTY, VTS_NONE)
  198. /////////////////////////////////////////////////////////////////////////////
  199. // Macros for object factory and class ID
  200. #define BEGIN_OLEFACTORY(class_name) \
  201. protected: \
  202. class class_name##Factory : public COleObjectFactoryEx \
  203. { \
  204. public: \
  205. class_name##Factory(REFCLSID clsid, CRuntimeClass* pRuntimeClass, \
  206. BOOL bMultiInstance, LPCTSTR lpszProgID) : \
  207. COleObjectFactoryEx(clsid, pRuntimeClass, bMultiInstance, \
  208. lpszProgID) {} \
  209. virtual BOOL UpdateRegistry(BOOL);
  210. #define END_OLEFACTORY(class_name) \
  211. }; \
  212. friend class class_name##Factory; \
  213. static AFX_DATA class_name##Factory factory; \
  214. public: \
  215. static AFX_DATA const GUID guid; \
  216. virtual HRESULT GetClassID(LPCLSID pclsid);
  217. #define DECLARE_OLECREATE_EX(class_name) \
  218. BEGIN_OLEFACTORY(class_name) \
  219. END_OLEFACTORY(class_name)
  220. #define IMPLEMENT_OLECREATE_EX(class_name, external_name, \
  221. l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  222. const TCHAR _szProgID_##class_name[] = _T(external_name); \
  223. AFX_DATADEF class_name::class_name##Factory class_name::factory( \
  224. class_name::guid, RUNTIME_CLASS(class_name), FALSE, \
  225. _szProgID_##class_name); \
  226. const AFX_DATADEF GUID class_name::guid = \
  227. { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }; \
  228. HRESULT class_name::GetClassID(LPCLSID pclsid) \
  229. { *pclsid = guid; return NOERROR; }
  230. /////////////////////////////////////////////////////////////////////////////
  231. // Macros for type name and misc status
  232. #define DECLARE_OLECTLTYPE(class_name) \
  233. virtual UINT GetUserTypeNameID(); \
  234. virtual DWORD GetMiscStatus();
  235. #define IMPLEMENT_OLECTLTYPE(class_name, idsUserTypeName, dwOleMisc) \
  236. UINT class_name::GetUserTypeNameID() { return idsUserTypeName; } \
  237. DWORD class_name::GetMiscStatus() { return dwOleMisc; }
  238. /////////////////////////////////////////////////////////////////////////////
  239. // Macros for property page IDs
  240. #define DECLARE_PROPPAGEIDS(class_name) \
  241. protected: \
  242. virtual LPCLSID GetPropPageIDs(ULONG& cPropPages);
  243. #define BEGIN_PROPPAGEIDS(class_name, count) \
  244. static CLSID _rgPropPageIDs_##class_name[count]; \
  245. AFX_COMDAT ULONG _cPropPages_##class_name = (ULONG)-1; \
  246. LPCLSID class_name::GetPropPageIDs(ULONG& cPropPages) { \
  247. if (_cPropPages_##class_name == (ULONG)-1) { \
  248. _cPropPages_##class_name = count; \
  249. LPCLSID pIDs = _rgPropPageIDs_##class_name; \
  250. ULONG iPageMax = count; \
  251. ULONG iPage = 0;
  252. #define PROPPAGEID(clsid) \
  253. ASSERT(iPage < iPageMax); \
  254. if (iPage < iPageMax) \
  255. pIDs[iPage++] = clsid;
  256. #define END_PROPPAGEIDS(class_name) \
  257. ASSERT(iPage == iPageMax); \
  258. } \
  259. cPropPages = _cPropPages_##class_name; \
  260. return _rgPropPageIDs_##class_name; }
  261. /////////////////////////////////////////////////////////////////////////////
  262. // CFontHolder - helper class for dealing with font objects
  263. class CFontHolder
  264. {
  265. // Constructors
  266. public:
  267. CFontHolder(LPPROPERTYNOTIFYSINK pNotify);
  268. // Attributes
  269. LPFONT m_pFont;
  270. // Operations
  271. void InitializeFont(
  272. const FONTDESC* pFontDesc = NULL,
  273. LPDISPATCH pFontDispAmbient = NULL);
  274. void SetFont(LPFONT pNewFont);
  275. void ReleaseFont();
  276. HFONT GetFontHandle();
  277. HFONT GetFontHandle(long cyLogical, long cyHimetric);
  278. CFont* Select(CDC* pDC, long cyLogical, long cyHimetric);
  279. BOOL GetDisplayString(CString& strValue);
  280. LPFONTDISP GetFontDispatch();
  281. void QueryTextMetrics(LPTEXTMETRIC lptm);
  282. // Implementation
  283. public:
  284. ~CFontHolder();
  285. void SetFontNotifySink(LPPROPERTYNOTIFYSINK pNotify);
  286. protected:
  287. DWORD m_dwConnectCookie;
  288. LPPROPERTYNOTIFYSINK m_pNotify;
  289. };
  290. /////////////////////////////////////////////////////////////////////////////
  291. // CPictureHolder - helper class for dealing with picture objects
  292. class CPictureHolder
  293. {
  294. // Constructors
  295. public:
  296. CPictureHolder();
  297. // Attributes
  298. LPPICTURE m_pPict;
  299. // Operations
  300. BOOL CreateEmpty();
  301. BOOL CreateFromBitmap(UINT idResource);
  302. BOOL CreateFromBitmap(CBitmap* pBitmap, CPalette* pPal = NULL,
  303. BOOL bTransferOwnership = TRUE);
  304. BOOL CreateFromBitmap(HBITMAP hbm, HPALETTE hpal = NULL,
  305. BOOL bTransferOwnership = FALSE);
  306. BOOL CreateFromMetafile(HMETAFILE hmf, int xExt, int yExt,
  307. BOOL bTransferOwnership = FALSE);
  308. BOOL CreateFromIcon(UINT idResource);
  309. BOOL CreateFromIcon(HICON hIcon, BOOL bTransferOwnership = FALSE);
  310. short GetType();
  311. BOOL GetDisplayString(CString& strValue);
  312. LPPICTUREDISP GetPictureDispatch();
  313. void SetPictureDispatch(LPPICTUREDISP pDisp);
  314. void Render(CDC* pDC, const CRect& rcRender, const CRect& rcWBounds);
  315. // Implementation
  316. public:
  317. ~CPictureHolder();
  318. };
  319. /////////////////////////////////////////////////////////////////////////////
  320. // CDataPathProperty - Asynchonous properties for OLE Controls
  321. class CDataPathProperty: public CAsyncMonikerFile
  322. {
  323. DECLARE_DYNAMIC(CDataPathProperty)
  324. // Constructors
  325. public:
  326. CDataPathProperty(COleControl* pControl = NULL);
  327. CDataPathProperty(LPCTSTR lpszPath, COleControl* pControl = NULL);
  328. // Calls SetPath(pControl) and SetPath(lpszPath) as appropriate.
  329. // Attributes
  330. public:
  331. void SetPath(LPCTSTR lpszPath);
  332. // Sets the path to be opened by Open(COleControl*) and Open()
  333. // lpszPath may be NULL.
  334. CString GetPath() const;
  335. // Returns the current path setting. Result may be empty.
  336. COleControl* GetControl();
  337. // Returns a Pointer to the control. Result may be NULL.
  338. void SetControl(COleControl* pControl);
  339. // Sets the control which will be used with Open. pControl may be NULL.
  340. // Operations
  341. public:
  342. // Overloads of Open takings some or all of: a path, a control,
  343. // and a CFileException
  344. // Overloads taking a COleControl call SetControl(pControl)
  345. // Overloads taking an LPCTSTR cal SetPath(lpszPath)
  346. virtual BOOL Open(COleControl* pControl, CFileException* pError = NULL);
  347. virtual BOOL Open(LPCTSTR lpszPath, COleControl* pControl,
  348. CFileException* pError = NULL);
  349. virtual BOOL Open(LPCTSTR lpszPath, CFileException* pError = NULL);
  350. virtual BOOL Open(CFileException* pError = NULL);
  351. // Attempts to obtain an IBindHost* from the control returned by
  352. // GetControl(). Calls CAsyncMonikerFile::Open with the path returned by
  353. // GetPath() and, if it was obtained, the IBindHost*.
  354. // Returns TRUE if successful.
  355. // Overridables
  356. public:
  357. virtual void ResetData();
  358. // Derived classes should overide this.
  359. // Implementation
  360. public:
  361. #ifdef _DEBUG
  362. virtual void AssertValid() const;
  363. virtual void Dump(CDumpContext& dc) const;
  364. #endif
  365. private:
  366. COleControl* m_pControl;
  367. CString m_strPath;
  368. };
  369. /////////////////////////////////////////////////////////////////////////////
  370. // CCachedDataPathProperty - Cached asynchonous properties for OLE Controls
  371. class CCachedDataPathProperty : public CDataPathProperty
  372. {
  373. DECLARE_DYNAMIC(CCachedDataPathProperty)
  374. //Constructors
  375. public:
  376. CCachedDataPathProperty(COleControl* pControl = NULL);
  377. CCachedDataPathProperty(LPCTSTR lpszPath, COleControl* pControl = NULL);
  378. // Attributes
  379. public:
  380. CMemFile m_Cache;
  381. // Implementation
  382. public:
  383. virtual void OnDataAvailable(DWORD dwSize, DWORD bscfFlag);
  384. virtual void Close();
  385. virtual void ResetData();
  386. #ifdef _DEBUG
  387. virtual void AssertValid() const;
  388. virtual void Dump(CDumpContext& dc) const;
  389. #endif
  390. };
  391. /////////////////////////////////////////////////////////////////////////////
  392. // COleControl - base class for a control implemented in C++ with MFC
  393. struct _AFXCTL_ADVISE_INFO; // implementation class
  394. struct _AFXCTL_UIACTIVE_INFO; // implementation class
  395. class CControlRectTracker : public CRectTracker
  396. {
  397. // Implementation
  398. public:
  399. CControlRectTracker(LPCRECT lpSrcRect, UINT nStyle)
  400. : CRectTracker(lpSrcRect, nStyle) { }
  401. CRect m_rectClip; // saves the original clipping rectangle
  402. };
  403. #ifdef _AFXDLL
  404. class COleControl : public CWnd
  405. #else
  406. class AFX_NOVTABLE COleControl : public CWnd
  407. #endif
  408. {
  409. DECLARE_DYNAMIC(COleControl)
  410. // Constructors
  411. public:
  412. COleControl();
  413. // Operations
  414. // Initialization
  415. void SetInitialSize(int cx, int cy);
  416. void InitializeIIDs(const IID* piidPrimary, const IID* piidEvents);
  417. // Invalidating
  418. void InvalidateControl(LPCRECT lpRect = NULL, BOOL bErase = TRUE);
  419. // Modified flag
  420. BOOL IsModified();
  421. void SetModifiedFlag(BOOL bModified = TRUE);
  422. // Drawing operations
  423. void DoSuperclassPaint(CDC* pDC, const CRect& rcBounds);
  424. BOOL IsOptimizedDraw();
  425. // Property exchange
  426. BOOL ExchangeVersion(CPropExchange* pPX, DWORD dwVersionDefault,
  427. BOOL bConvert = TRUE);
  428. BOOL ExchangeExtent(CPropExchange* pPX);
  429. void ExchangeStockProps(CPropExchange* pPX);
  430. BOOL IsConvertingVBX();
  431. DWORD SerializeVersion(CArchive& ar, DWORD dwVersionDefault,
  432. BOOL bConvert = TRUE);
  433. void SerializeExtent(CArchive& ar);
  434. void SerializeStockProps(CArchive& ar);
  435. void ResetVersion(DWORD dwVersionDefault);
  436. void ResetStockProps();
  437. // Stock methods
  438. void Refresh();
  439. void DoClick();
  440. // Stock properties
  441. short GetAppearance();
  442. void SetAppearance(short);
  443. OLE_COLOR GetBackColor();
  444. void SetBackColor(OLE_COLOR);
  445. short GetBorderStyle();
  446. void SetBorderStyle(short);
  447. BOOL GetEnabled();
  448. void SetEnabled(BOOL);
  449. CFontHolder& InternalGetFont();
  450. LPFONTDISP GetFont();
  451. void SetFont(LPFONTDISP);
  452. OLE_COLOR GetForeColor();
  453. void SetForeColor(OLE_COLOR);
  454. OLE_HANDLE GetHwnd();
  455. const CString& InternalGetText();
  456. BSTR GetText();
  457. void SetText(LPCTSTR);
  458. long GetReadyState();
  459. void InternalSetReadyState(long lNewReadyState);
  460. // Using colors
  461. COLORREF TranslateColor(OLE_COLOR clrColor, HPALETTE hpal = NULL);
  462. // Using fonts
  463. CFont* SelectStockFont(CDC* pDC);
  464. CFont* SelectFontObject(CDC* pDC, CFontHolder& fontHolder);
  465. void GetStockTextMetrics(LPTEXTMETRIC lptm);
  466. void GetFontTextMetrics(LPTEXTMETRIC lptm, CFontHolder& fontHolder);
  467. // Client site access
  468. LPOLECLIENTSITE GetClientSite();
  469. // Generic ambient property access
  470. BOOL GetAmbientProperty(DISPID dispid, VARTYPE vtProp, void* pvProp);
  471. BOOL WillAmbientsBeValidDuringLoad();
  472. // Specific ambient properties
  473. short AmbientAppearance();
  474. OLE_COLOR AmbientBackColor();
  475. CString AmbientDisplayName();
  476. LPFONTDISP AmbientFont();
  477. OLE_COLOR AmbientForeColor();
  478. LCID AmbientLocaleID();
  479. CString AmbientScaleUnits();
  480. short AmbientTextAlign();
  481. BOOL AmbientUserMode();
  482. BOOL AmbientUIDead();
  483. BOOL AmbientShowGrabHandles();
  484. BOOL AmbientShowHatching();
  485. // Firing events
  486. void AFX_CDECL FireEvent(DISPID dispid, BYTE* pbParams, ...);
  487. // Firing functions for stock events
  488. void FireKeyDown(USHORT* pnChar, short nShiftState);
  489. void FireKeyUp(USHORT* pnChar, short nShiftState);
  490. void FireKeyPress(USHORT* pnChar);
  491. void FireMouseDown(short nButton, short nShiftState,
  492. OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);
  493. void FireMouseUp(short nButton, short nShiftState,
  494. OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);
  495. void FireMouseMove(short nButton, short nShiftState,
  496. OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);
  497. void FireClick();
  498. void FireDblClick();
  499. void FireError(SCODE scode, LPCTSTR lpszDescription, UINT nHelpID = 0);
  500. void FireReadyStateChange();
  501. // Changing size and/or rectangle
  502. BOOL GetRectInContainer(LPRECT lpRect);
  503. BOOL SetRectInContainer(LPCRECT lpRect);
  504. void GetControlSize(int* pcx, int* pcy);
  505. BOOL SetControlSize(int cx, int cy);
  506. // Window management
  507. void RecreateControlWindow();
  508. // Modal dialog operations
  509. void PreModalDialog(HWND hWndParent = NULL);
  510. void PostModalDialog(HWND hWndParent = NULL);
  511. // Data binding operations
  512. void BoundPropertyChanged(DISPID dispid);
  513. BOOL BoundPropertyRequestEdit(DISPID dispid);
  514. // Dispatch exceptions
  515. void ThrowError(SCODE sc, UINT nDescriptionID, UINT nHelpID = -1);
  516. void ThrowError(SCODE sc, LPCTSTR pszDescription = NULL, UINT nHelpID = 0);
  517. void GetNotSupported();
  518. void SetNotSupported();
  519. void SetNotPermitted();
  520. // Communication with the control site
  521. void ControlInfoChanged();
  522. BOOL LockInPlaceActive(BOOL bLock);
  523. LPDISPATCH GetExtendedControl();
  524. void TransformCoords(POINTL* lpptlHimetric,
  525. POINTF* lpptfContainer, DWORD flags);
  526. // Simple frame
  527. void EnableSimpleFrame();
  528. // Windowless operations
  529. CWnd* SetCapture();
  530. BOOL ReleaseCapture();
  531. CWnd* GetCapture();
  532. CWnd* SetFocus();
  533. CWnd* GetFocus();
  534. CDC* GetDC(LPCRECT lprcRect = NULL, DWORD dwFlags = OLEDC_PAINTBKGND);
  535. int ReleaseDC(CDC* pDC);
  536. void InvalidateRgn(CRgn* pRgn, BOOL bErase = TRUE);
  537. void ScrollWindow(int xAmount, int yAmount, LPCRECT lpRect = NULL,
  538. LPCRECT lpClipRect = NULL);
  539. BOOL ClipCaretRect(LPRECT lpRect);
  540. virtual void GetClientRect(LPRECT lpRect) const;
  541. // Overridables
  542. virtual void DoPropExchange(CPropExchange* pPX);
  543. virtual void OnResetState();
  544. virtual void OnDraw(
  545. CDC* pDC, const CRect& rcBounds, const CRect& rcInvalid);
  546. virtual void OnDrawMetafile(CDC* pDC, const CRect& rcBounds);
  547. // Class ID (implemented by IMPLEMENT_OLECREATE_EX macro)
  548. virtual HRESULT GetClassID(LPCLSID pclsid) = 0;
  549. // For customizing the default messages on the status bar
  550. virtual void GetMessageString(UINT nID, CString& rMessage) const;
  551. // Display of error events to user
  552. virtual void DisplayError(SCODE scode, LPCTSTR lpszDescription,
  553. LPCTSTR lpszSource, LPCTSTR lpszHelpFile, UINT nHelpID);
  554. // IOleObject notifications
  555. virtual void OnSetClientSite();
  556. virtual BOOL OnSetExtent(LPSIZEL lpSizeL);
  557. virtual void OnClose(DWORD dwSaveOption);
  558. // IOleInPlaceObject notifications
  559. virtual BOOL OnSetObjectRects(LPCRECT lpRectPos, LPCRECT lpRectClip);
  560. // Event connection point notifications
  561. virtual void OnEventAdvise(BOOL bAdvise);
  562. // Override to hook firing of Click event
  563. virtual void OnClick(USHORT iButton);
  564. // Override to get character after key events have been processed.
  565. virtual void OnKeyDownEvent(USHORT nChar, USHORT nShiftState);
  566. virtual void OnKeyUpEvent(USHORT nChar, USHORT nShiftState);
  567. virtual void OnKeyPressEvent(USHORT nChar);
  568. // Change notifications
  569. virtual void OnAppearanceChanged();
  570. virtual void OnBackColorChanged();
  571. virtual void OnBorderStyleChanged();
  572. virtual void OnEnabledChanged();
  573. virtual void OnTextChanged();
  574. virtual void OnFontChanged();
  575. virtual void OnForeColorChanged();
  576. // IOleControl notifications
  577. virtual void OnGetControlInfo(LPCONTROLINFO pControlInfo);
  578. virtual void OnMnemonic(LPMSG pMsg);
  579. virtual void OnAmbientPropertyChange(DISPID dispid);
  580. virtual void OnFreezeEvents(BOOL bFreeze);
  581. // In-place activation
  582. virtual HMENU OnGetInPlaceMenu();
  583. virtual void OnShowToolBars();
  584. virtual void OnHideToolBars();
  585. // IViewObject
  586. virtual BOOL OnGetColorSet(DVTARGETDEVICE* ptd, HDC hicTargetDev,
  587. LPLOGPALETTE* ppColorSet);
  588. virtual BOOL OnGetViewExtent(DWORD dwDrawAspect, LONG lindex,
  589. DVTARGETDEVICE* ptd, LPSIZEL lpsizel);
  590. virtual BOOL OnGetViewRect(DWORD dwAspect, LPRECTL pRect);
  591. virtual DWORD OnGetViewStatus();
  592. virtual BOOL OnQueryHitPoint(DWORD dwAspect, LPCRECT pRectBounds,
  593. POINT ptlLoc, LONG lCloseHint, DWORD* pHitResult);
  594. virtual BOOL OnQueryHitRect(DWORD dwAspect, LPCRECT pRectBounds,
  595. LPCRECT prcLoc, LONG lCloseHint, DWORD* pHitResult);
  596. virtual BOOL OnGetNaturalExtent(DWORD dwAspect, LONG lindex,
  597. DVTARGETDEVICE* ptd, HDC hicTargetDev, DVEXTENTINFO* pExtentInfo,
  598. LPSIZEL psizel);
  599. // IDataObject - see COleDataSource for a description of these overridables
  600. virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal);
  601. virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile);
  602. virtual BOOL OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
  603. virtual BOOL OnSetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
  604. BOOL bRelease);
  605. // Verbs
  606. virtual BOOL OnEnumVerbs(LPENUMOLEVERB* ppenumOleVerb);
  607. virtual BOOL OnDoVerb(LONG iVerb, LPMSG lpMsg, HWND hWndParent, LPCRECT lpRect);
  608. virtual BOOL OnEdit(LPMSG lpMsg, HWND hWndParent, LPCRECT lpRect);
  609. virtual BOOL OnProperties(LPMSG lpMsg, HWND hWndParent, LPCRECT lpRect);
  610. // IPerPropertyBrowsing overrides
  611. virtual BOOL OnGetDisplayString(DISPID dispid, CString& strValue);
  612. virtual BOOL OnMapPropertyToPage(DISPID dispid, LPCLSID lpclsid,
  613. BOOL* pbPageOptional);
  614. virtual BOOL OnGetPredefinedStrings(DISPID dispid,
  615. CStringArray* pStringArray, CDWordArray* pCookieArray);
  616. virtual BOOL OnGetPredefinedValue(DISPID dispid, DWORD dwCookie,
  617. VARIANT* lpvarOut);
  618. // Subclassing
  619. virtual BOOL IsSubclassedControl();
  620. // Window reparenting
  621. virtual void ReparentControlWindow(HWND hWndOuter, HWND hWndParent);
  622. // Window procedure
  623. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  624. // General-purpose flags
  625. enum ControlFlags {
  626. fastBeginPaint = 0x0001,
  627. clipPaintDC = 0x0002,
  628. pointerInactive = 0x0004,
  629. noFlickerActivate = 0x0008,
  630. windowlessActivate = 0x0010,
  631. canOptimizeDraw = 0x0020,
  632. };
  633. virtual DWORD GetControlFlags();
  634. // Inactive pointer handling
  635. virtual DWORD GetActivationPolicy();
  636. virtual BOOL OnInactiveSetCursor(LPCRECT lprcBounds, long x, long y,
  637. DWORD dwMouseMsg, BOOL bSetAlways);
  638. virtual void OnInactiveMouseMove(LPCRECT lprcBounds, long x, long y,
  639. DWORD dwKeyState);
  640. // Windowless activation handling
  641. virtual BOOL OnWindowlessMessage(UINT msg, WPARAM wParam, LPARAM lParam,
  642. LRESULT* plResult);
  643. virtual IDropTarget* GetWindowlessDropTarget();
  644. // Inactive/windowless helper functions
  645. virtual void GetClientOffset(long* pdxOffset, long* pdyOffset) const;
  646. virtual UINT ParentToClient(LPCRECT lprcBounds, LPPOINT pPoint,
  647. BOOL bHitTest = FALSE) const;
  648. virtual void ClientToParent(LPCRECT lprcBounds, LPPOINT pPoint) const;
  649. // Asynchronous properties
  650. void Load(LPCTSTR strNewPath, CDataPathProperty& prop);
  651. // Implementation
  652. public:
  653. ~COleControl();
  654. void RequestAsynchronousExchange(DWORD dwVersion);
  655. #ifdef _DEBUG
  656. void AssertValid() const;
  657. void Dump(CDumpContext& dc) const;
  658. #endif // _DEBUG
  659. protected:
  660. // Friend classes
  661. friend class COleControlInnerUnknown;
  662. friend class CReflectorWnd;
  663. friend class CControlFrameWnd;
  664. // Interface hook for primary automation interface
  665. LPUNKNOWN GetInterfaceHook(const void* piid);
  666. // Shutdown
  667. virtual void OnFinalRelease();
  668. void ReleaseCaches();
  669. // Window management
  670. virtual BOOL CreateControlWindow(HWND hWndParent, const CRect& rcPos,
  671. LPCRECT prcClipped = NULL);
  672. void CreateWindowForSubclassedControl();
  673. BOOL IgnoreWindowMessage(UINT msg, WPARAM wParam, LPARAM lParam,
  674. LRESULT* plResult);
  675. virtual LRESULT DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
  676. // Serialization
  677. HRESULT SaveState(IStream* pStm);
  678. HRESULT LoadState(IStream* pStm);
  679. virtual void Serialize(CArchive& ar);
  680. // Drawing
  681. void DrawContent(CDC* pDC, CRect& rc);
  682. void DrawMetafile(CDC* pDC, CRect& rc);
  683. BOOL GetMetafileData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
  684. // Implementation of IDataObject
  685. // CControlDataSource implements OnRender reflections to COleControl
  686. class CControlDataSource : public COleDataSource
  687. {
  688. public:
  689. CControlDataSource(COleControl* pCtrl);
  690. protected:
  691. virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal);
  692. virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile);
  693. virtual BOOL OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
  694. virtual BOOL OnSetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
  695. BOOL bRelease);
  696. COleControl* m_pCtrl;
  697. };
  698. friend class CControlDataSource;
  699. // IDataObject formats
  700. CControlDataSource* GetDataSource();
  701. virtual void SetInitialDataFormats();
  702. BOOL GetPropsetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
  703. REFCLSID fmtid);
  704. BOOL SetPropsetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
  705. REFCLSID fmtid);
  706. // Type library
  707. BOOL GetDispatchIID(IID* pIID);
  708. // Connection point container
  709. virtual LPCONNECTIONPOINT GetConnectionHook(REFIID iid);
  710. virtual BOOL GetExtraConnectionPoints(CPtrArray* pConnPoints);
  711. // Events
  712. static const AFX_DATA AFX_EVENTMAP_ENTRY _eventEntries[];
  713. virtual const AFX_EVENTMAP* GetEventMap() const;
  714. static const AFX_DATA AFX_EVENTMAP eventMap;
  715. const AFX_EVENTMAP_ENTRY* GetEventMapEntry(LPCTSTR pszName,
  716. DISPID* pDispid) const;
  717. void FireEventV(DISPID dispid, BYTE* pbParams, va_list argList);
  718. // Stock events
  719. void KeyDown(USHORT* pnChar);
  720. void KeyUp(USHORT* pnChar);
  721. void ButtonDown(USHORT iButton, UINT nFlags, CPoint point);
  722. void ButtonUp(USHORT iButton, UINT nFlags, CPoint point);
  723. void ButtonDblClk(USHORT iButton, UINT nFlags, CPoint point);
  724. // Masks to identify which stock events and properties are used
  725. void InitStockEventMask();
  726. void InitStockPropMask();
  727. DWORD GetStockEventMask() const;
  728. DWORD GetStockPropMask() const;
  729. // Support for subclassing a Windows control
  730. CWnd* GetOuterWindow() const; // m_pReflect if any, otherwise this
  731. virtual void OnReflectorDestroyed();
  732. // Aggregation of default handler
  733. virtual BOOL OnCreateAggregates();
  734. LPVOID QueryDefHandler(REFIID iid);
  735. // State change notifications
  736. void SendAdvise(UINT uCode);
  737. // Non-in-place activation
  738. virtual HRESULT OnOpen(BOOL bTryInPlace, LPMSG pMsg);
  739. #ifdef _AFXDLL
  740. void ResizeOpenControl(int cx, int cy);
  741. virtual CControlFrameWnd* CreateFrameWindow();
  742. virtual void ResizeFrameWindow(int cx, int cy);
  743. virtual void OnFrameClose();
  744. #endif
  745. virtual HRESULT OnHide();
  746. // In-place activation
  747. virtual HRESULT OnActivateInPlace(BOOL bUIActivate, LPMSG pMsg);
  748. void ForwardActivationMsg(LPMSG pMsg);
  749. virtual void AddFrameLevelUI();
  750. virtual void RemoveFrameLevelUI();
  751. virtual BOOL BuildSharedMenu();
  752. virtual void DestroySharedMenu();
  753. // Property sheet
  754. virtual LPCLSID GetPropPageIDs(ULONG& cPropPages);
  755. // IOleObject implementation
  756. void GetUserType(LPTSTR pszUserType);
  757. virtual UINT GetUserTypeNameID() = 0;
  758. virtual DWORD GetMiscStatus() = 0;
  759. // Rectangle tracker
  760. void CreateTracker(BOOL bHandles, BOOL bHatching);
  761. void CreateTracker(BOOL bHandles, BOOL bHatching, LPCRECT prcClip);
  762. void DestroyTracker();
  763. // Automation
  764. BOOL IsInvokeAllowed(DISPID dispid);
  765. // Ambient property interface initialization
  766. COleDispatchDriver* GetAmbientDispatchDriver();
  767. // Data members
  768. const IID* m_piidPrimary; // IID for control automation
  769. const IID* m_piidEvents; // IID for control events
  770. DWORD m_dwVersionLoaded; // Version number of loaded state
  771. COleDispatchDriver m_ambientDispDriver; // Driver for ambient properties
  772. ULONG m_cEventsFrozen; // Event freeze count (>0 means frozen)
  773. union
  774. {
  775. #ifdef _AFXDLL
  776. CControlFrameWnd* m_pWndOpenFrame; // Open frame window.
  777. #endif
  778. CControlRectTracker* m_pRectTracker; // Tracker for UI active control
  779. };
  780. CRect m_rcPos; // Control's position rectangle
  781. CRect m_rcBounds; // Bounding rectangle for drawing
  782. CPoint m_ptOffset; // Child window origin
  783. long m_cxExtent; // Control's width in HIMETRIC units
  784. long m_cyExtent; // Control's height in HIMETRIC units
  785. class CReflectorWnd* m_pReflect; // Reflector window
  786. UINT m_nIDTracking; // Tracking command ID or string IDS
  787. UINT m_nIDLastMessage; // Last displayed message string IDS
  788. unsigned m_bAutoMenuEnable : 1; // Disable menu items without handlers?
  789. unsigned m_bFinalReleaseCalled : 1; // Are we handling the final Release?
  790. unsigned m_bModified : 1; // "Dirty" bit.
  791. unsigned m_bCountOnAmbients : 1; // Can we count on Ambients during load?
  792. unsigned m_iButtonState : 3; // Which buttons are down?
  793. unsigned m_iDblClkState : 3; // Which buttons involved in dbl click?
  794. unsigned m_bInPlaceActive : 1; // Are we in-place active?
  795. unsigned m_bUIActive : 1; // Are we UI active?
  796. unsigned m_bPendingUIActivation : 1; // Are we about to become UI active?
  797. #ifdef _AFXDLL
  798. unsigned m_bOpen : 1; // Are we open (non-in-place)?
  799. #endif
  800. unsigned m_bChangingExtent : 1; // Extent is currently being changed
  801. unsigned m_bConvertVBX : 1; // VBX conversion in progress
  802. unsigned m_bSimpleFrame : 1; // Simple frame support
  803. unsigned m_bUIDead : 1; // UIDead ambient property value
  804. unsigned m_bInitialized : 1; // Was IPersist*::{InitNew,Load} called?
  805. unsigned m_bAutoClip : 1; // Does container automatically clip?
  806. unsigned m_bMsgReflect : 1; // Does container reflect messages?
  807. unsigned m_bInPlaceSiteEx : 1; // Extended in-place site?
  808. unsigned m_bInPlaceSiteWndless : 1; // Windowless in-place site?
  809. unsigned m_bNoRedraw : 1; // Should we skip OnPaint this time?
  810. unsigned m_bOptimizedDraw : 1; // Is optimized drawing possible?
  811. // Stock properties
  812. OLE_COLOR m_clrBackColor; // BackColor
  813. OLE_COLOR m_clrForeColor; // ForeColor
  814. CString m_strText; // Text/Caption
  815. CFontHolder m_font; // Font
  816. HFONT m_hFontPrev; // Previously selected font object
  817. short m_sAppearance; // Appearance
  818. short m_sBorderStyle; // BorderStyle
  819. BOOL m_bEnabled; // Enabled
  820. long m_lReadyState; // ReadyState
  821. // UI Active info (shared OLE menu data)
  822. _AFXCTL_UIACTIVE_INFO* m_pUIActiveInfo;
  823. // Default Handler aggregation
  824. LPUNKNOWN m_pDefIUnknown;
  825. _AFXCTL_ADVISE_INFO* m_pAdviseInfo;
  826. LPPERSISTSTORAGE m_pDefIPersistStorage;
  827. LPVIEWOBJECT m_pDefIViewObject;
  828. LPOLECACHE m_pDefIOleCache;
  829. // OLE client site interfaces
  830. LPOLECLIENTSITE m_pClientSite; // Client site
  831. union
  832. {
  833. LPOLEINPLACESITE m_pInPlaceSite; // In-place site
  834. LPOLEINPLACESITEEX m_pInPlaceSiteEx;
  835. LPOLEINPLACESITEWINDOWLESS m_pInPlaceSiteWndless;
  836. };
  837. LPOLECONTROLSITE m_pControlSite; // Control site
  838. LPOLEADVISEHOLDER m_pOleAdviseHolder; // Advise holder
  839. LPDATAADVISEHOLDER m_pDataAdviseHolder; // Data advise holder
  840. LPSIMPLEFRAMESITE m_pSimpleFrameSite; // Simple frame site
  841. // OLE in-place activation info
  842. LPOLEINPLACEFRAME m_pInPlaceFrame;
  843. OLEINPLACEFRAMEINFO m_frameInfo;
  844. LPOLEINPLACEUIWINDOW m_pInPlaceDoc;
  845. // OLE data source
  846. CControlDataSource* m_pDataSource;
  847. // OLE data path load data
  848. BOOL m_bDataPathPropertiesLoaded;
  849. DWORD m_dwDataPathVersionToReport;
  850. // Message Maps
  851. protected:
  852. //{{AFX_MSG(COleControl)
  853. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  854. afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  855. afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  856. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  857. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  858. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  859. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  860. afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
  861. afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
  862. afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
  863. afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  864. afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
  865. afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
  866. afx_msg void OnInitMenuPopup(CMenu*, UINT, BOOL);
  867. afx_msg void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu);
  868. afx_msg LRESULT OnSetMessageString(WPARAM wParam, LPARAM lParam);
  869. afx_msg void OnEnterIdle(UINT nWhy, CWnd* pWho);
  870. afx_msg void OnCancelMode();
  871. afx_msg void OnPaint(CDC* pDC);
  872. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  873. afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  874. afx_msg void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  875. afx_msg int OnMouseActivate(CWnd *pDesktopWnd, UINT nHitTest, UINT message);
  876. afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
  877. afx_msg BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct);
  878. afx_msg void OnDestroy();
  879. afx_msg void OnKillFocus(CWnd* pNewWnd);
  880. afx_msg void OnSetFocus(CWnd* pOldWnd);
  881. afx_msg void OnNcPaint();
  882. afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
  883. afx_msg UINT OnNcHitTest(CPoint point);
  884. afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
  885. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  886. afx_msg UINT OnGetDlgCode();
  887. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  888. afx_msg void OnSize(UINT nType, int cx, int cy);
  889. afx_msg void OnMove(int x, int y);
  890. afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
  891. //}}AFX_MSG
  892. afx_msg LRESULT OnOcmCtlColorBtn(WPARAM wParam, LPARAM lParam);
  893. afx_msg LRESULT OnOcmCtlColorDlg(WPARAM wParam, LPARAM lParam);
  894. afx_msg LRESULT OnOcmCtlColorEdit(WPARAM wParam, LPARAM lParam);
  895. afx_msg LRESULT OnOcmCtlColorListBox(WPARAM wParam, LPARAM lParam);
  896. afx_msg LRESULT OnOcmCtlColorMsgBox(WPARAM wParam, LPARAM lParam);
  897. afx_msg LRESULT OnOcmCtlColorScrollBar(WPARAM wParam, LPARAM lParam);
  898. afx_msg LRESULT OnOcmCtlColorStatic(WPARAM wParam, LPARAM lParam);
  899. DECLARE_MESSAGE_MAP()
  900. // button handler helpers
  901. void OnButtonUp(USHORT nButton, UINT nFlags, CPoint point);
  902. void OnButtonDown(USHORT nButton, UINT nFlags, CPoint point);
  903. void OnButtonDblClk(USHORT nButton, UINT nFlags, CPoint point);
  904. // Interface Maps
  905. public:
  906. // IPersistStorage
  907. BEGIN_INTERFACE_PART(PersistStorage, IPersistStorage)
  908. INIT_INTERFACE_PART(COleControl, PersistStorage)
  909. STDMETHOD(GetClassID)(LPCLSID);
  910. STDMETHOD(IsDirty)();
  911. STDMETHOD(InitNew)(LPSTORAGE);
  912. STDMETHOD(Load)(LPSTORAGE);
  913. STDMETHOD(Save)(LPSTORAGE, BOOL);
  914. STDMETHOD(SaveCompleted)(LPSTORAGE);
  915. STDMETHOD(HandsOffStorage)();
  916. END_INTERFACE_PART_STATIC(PersistStorage)
  917. // IPersistStreamInit
  918. BEGIN_INTERFACE_PART(PersistStreamInit, IPersistStreamInit)
  919. INIT_INTERFACE_PART(COleControl, PersistStreamInit)
  920. STDMETHOD(GetClassID)(LPCLSID);
  921. STDMETHOD(IsDirty)();
  922. STDMETHOD(Load)(LPSTREAM);
  923. STDMETHOD(Save)(LPSTREAM, BOOL);
  924. STDMETHOD(GetSizeMax)(ULARGE_INTEGER *);
  925. STDMETHOD(InitNew)();
  926. END_INTERFACE_PART_STATIC(PersistStreamInit)
  927. // IPersistMemory
  928. BEGIN_INTERFACE_PART(PersistMemory, IPersistMemory)
  929. INIT_INTERFACE_PART(COleControl, PersistMemory)
  930. STDMETHOD(GetClassID)(LPCLSID);
  931. STDMETHOD(IsDirty)();
  932. STDMETHOD(Load)(LPVOID, ULONG);
  933. STDMETHOD(Save)(LPVOID, BOOL, ULONG);
  934. STDMETHOD(GetSizeMax)(ULONG*);
  935. STDMETHOD(InitNew)();
  936. END_INTERFACE_PART_STATIC(PersistMemory)
  937. // IPersistPropertyBag
  938. BEGIN_INTERFACE_PART(PersistPropertyBag, IPersistPropertyBag)
  939. INIT_INTERFACE_PART(COleControl, PersistPropertyBag)
  940. STDMETHOD(GetClassID)(LPCLSID);
  941. STDMETHOD(InitNew)();
  942. STDMETHOD(Load)(LPPROPERTYBAG, LPERRORLOG);
  943. STDMETHOD(Save)(LPPROPERTYBAG, BOOL, BOOL);
  944. END_INTERFACE_PART_STATIC(PersistPropertyBag)
  945. // IOleObject
  946. BEGIN_INTERFACE_PART(OleObject, IOleObject)
  947. INIT_INTERFACE_PART(COleControl, OleObject)
  948. STDMETHOD(SetClientSite)(LPOLECLIENTSITE);
  949. STDMETHOD(GetClientSite)(LPOLECLIENTSITE*);
  950. STDMETHOD(SetHostNames)(LPCOLESTR, LPCOLESTR);
  951. STDMETHOD(Close)(DWORD);
  952. STDMETHOD(SetMoniker)(DWORD, LPMONIKER);
  953. STDMETHOD(GetMoniker)(DWORD, DWORD, LPMONIKER*);
  954. STDMETHOD(InitFromData)(LPDATAOBJECT, BOOL, DWORD);
  955. STDMETHOD(GetClipboardData)(DWORD, LPDATAOBJECT*);
  956. STDMETHOD(DoVerb)(LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT);
  957. STDMETHOD(EnumVerbs)(IEnumOLEVERB**);
  958. STDMETHOD(Update)();
  959. STDMETHOD(IsUpToDate)();
  960. STDMETHOD(GetUserClassID)(CLSID*);
  961. STDMETHOD(GetUserType)(DWORD, LPOLESTR*);
  962. STDMETHOD(SetExtent)(DWORD, LPSIZEL);
  963. STDMETHOD(GetExtent)(DWORD, LPSIZEL);
  964. STDMETHOD(Advise)(LPADVISESINK, LPDWORD);
  965. STDMETHOD(Unadvise)(DWORD);
  966. STDMETHOD(EnumAdvise)(LPENUMSTATDATA*);
  967. STDMETHOD(GetMiscStatus)(DWORD, LPDWORD);
  968. STDMETHOD(SetColorScheme)(LPLOGPALETTE);
  969. END_INTERFACE_PART(OleObject)
  970. // IViewObjectEx
  971. BEGIN_INTERFACE_PART(ViewObject, IViewObjectEx)
  972. INIT_INTERFACE_PART(COleControl, ViewObject)
  973. STDMETHOD(Draw)(DWORD, LONG, void*, DVTARGETDEVICE*, HDC, HDC,
  974. LPCRECTL, LPCRECTL, BOOL (CALLBACK*)(DWORD), DWORD);
  975. STDMETHOD(GetColorSet)(DWORD, LONG, void*, DVTARGETDEVICE*,
  976. HDC, LPLOGPALETTE*);
  977. STDMETHOD(Freeze)(DWORD, LONG, void*, DWORD*);
  978. STDMETHOD(Unfreeze)(DWORD);
  979. STDMETHOD(SetAdvise)(DWORD, DWORD, LPADVISESINK);
  980. STDMETHOD(GetAdvise)(DWORD*, DWORD*, LPADVISESINK*);
  981. STDMETHOD(GetExtent) (DWORD, LONG, DVTARGETDEVICE*, LPSIZEL);
  982. STDMETHOD(GetRect)(DWORD, LPRECTL);
  983. STDMETHOD(GetViewStatus)(DWORD*);
  984. STDMETHOD(QueryHitPoint)(DWORD, LPCRECT, POINT, LONG, DWORD*);
  985. STDMETHOD(QueryHitRect)(DWORD, LPCRECT, LPCRECT, LONG, DWORD*);
  986. STDMETHOD(GetNaturalExtent)(DWORD, LONG, DVTARGETDEVICE*, HDC,
  987. DVEXTENTINFO*, LPSIZEL);
  988. END_INTERFACE_PART(ViewObject)
  989. // IDataObject
  990. BEGIN_INTERFACE_PART(DataObject, IDataObject)
  991. INIT_INTERFACE_PART(COleControl, DataObject)
  992. STDMETHOD(GetData)(LPFORMATETC, LPSTGMEDIUM);
  993. STDMETHOD(GetDataHere)(LPFORMATETC, LPSTGMEDIUM);
  994. STDMETHOD(QueryGetData)(LPFORMATETC);
  995. STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC, LPFORMATETC);
  996. STDMETHOD(SetData)(LPFORMATETC, LPSTGMEDIUM, BOOL);
  997. STDMETHOD(EnumFormatEtc)(DWORD, LPENUMFORMATETC*);
  998. STDMETHOD(DAdvise)(LPFORMATETC, DWORD, LPADVISESINK, LPDWORD);
  999. STDMETHOD(DUnadvise)(DWORD);
  1000. STDMETHOD(EnumDAdvise)(LPENUMSTATDATA*);
  1001. END_INTERFACE_PART_STATIC(DataObject)
  1002. // IOleInPlaceObject
  1003. BEGIN_INTERFACE_PART(OleInPlaceObject, IOleInPlaceObjectWindowless)
  1004. INIT_INTERFACE_PART(COleControl, OleInPlaceObject)
  1005. STDMETHOD(GetWindow)(HWND*);
  1006. STDMETHOD(ContextSensitiveHelp)(BOOL);
  1007. STDMETHOD(InPlaceDeactivate)();
  1008. STDMETHOD(UIDeactivate)();
  1009. STDMETHOD(SetObjectRects)(LPCRECT, LPCRECT);
  1010. STDMETHOD(ReactivateAndUndo)();
  1011. STDMETHOD(OnWindowMessage)(UINT msg, WPARAM wParam, LPARAM lparam,
  1012. LRESULT* plResult);
  1013. STDMETHOD(GetDropTarget)(IDropTarget **ppDropTarget);
  1014. END_INTERFACE_PART(OleInPlaceObject)
  1015. // IOleInPlaceActiveObject
  1016. BEGIN_INTERFACE_PART(OleInPlaceActiveObject, IOleInPlaceActiveObject)
  1017. INIT_INTERFACE_PART(COleControl, OleInPlaceActiveObject)
  1018. STDMETHOD(GetWindow)(HWND*);
  1019. STDMETHOD(ContextSensitiveHelp)(BOOL);
  1020. STDMETHOD(TranslateAccelerator)(LPMSG);
  1021. STDMETHOD(OnFrameWindowActivate)(BOOL);
  1022. STDMETHOD(OnDocWindowActivate)(BOOL);
  1023. STDMETHOD(ResizeBorder)(LPCRECT, LPOLEINPLACEUIWINDOW, BOOL);
  1024. STDMETHOD(EnableModeless)(BOOL);
  1025. END_INTERFACE_PART(OleInPlaceActiveObject)
  1026. // IOleCache
  1027. BEGIN_INTERFACE_PART(OleCache, IOleCache)
  1028. INIT_INTERFACE_PART(COleControl, OleCache)
  1029. STDMETHOD(Cache)(LPFORMATETC, DWORD, LPDWORD);
  1030. STDMETHOD(Uncache)(DWORD);
  1031. STDMETHOD(EnumCache)(LPENUMSTATDATA*);
  1032. STDMETHOD(InitCache)(LPDATAOBJECT);
  1033. STDMETHOD(SetData)(LPFORMATETC, STGMEDIUM*, BOOL);
  1034. END_INTERFACE_PART_STATIC(OleCache)
  1035. // IOleControl
  1036. BEGIN_INTERFACE_PART(OleControl, IOleControl)
  1037. INIT_INTERFACE_PART(COleControl, OleControl)
  1038. STDMETHOD(GetControlInfo)(LPCONTROLINFO pCI);
  1039. STDMETHOD(OnMnemonic)(LPMSG pMsg);
  1040. STDMETHOD(OnAmbientPropertyChange)(DISPID dispid);
  1041. STDMETHOD(FreezeEvents)(BOOL bFreeze);
  1042. END_INTERFACE_PART(OleControl)
  1043. // IProvideClassInfo2
  1044. BEGIN_INTERFACE_PART(ProvideClassInfo, IProvideClassInfo2)
  1045. INIT_INTERFACE_PART(COleControl, ProvideClassInfo)
  1046. STDMETHOD(GetClassInfo)(LPTYPEINFO* ppTypeInfo);
  1047. STDMETHOD(GetGUID)(DWORD dwGuidKind, GUID* pGUID);
  1048. END_INTERFACE_PART_STATIC(ProvideClassInfo)
  1049. // ISpecifyPropertyPages
  1050. BEGIN_INTERFACE_PART(SpecifyPropertyPages, ISpecifyPropertyPages)
  1051. INIT_INTERFACE_PART(COleControl, SpecifyPropertyPages)
  1052. STDMETHOD(GetPages)(CAUUID*);
  1053. END_INTERFACE_PART_STATIC(SpecifyPropertyPages)
  1054. // IPerPropertyBrowsing
  1055. BEGIN_INTERFACE_PART(PerPropertyBrowsing, IPerPropertyBrowsing)
  1056. INIT_INTERFACE_PART(COleControl, PerPropertyBrowsing)
  1057. STDMETHOD(GetDisplayString)(DISPID dispid, BSTR* lpbstr);
  1058. STDMETHOD(MapPropertyToPage)(DISPID dispid, LPCLSID lpclsid);
  1059. STDMETHOD(GetPredefinedStrings)(DISPID dispid,
  1060. CALPOLESTR* lpcaStringsOut, CADWORD* lpcaCookiesOut);
  1061. STDMETHOD(GetPredefinedValue)(DISPID dispid, DWORD dwCookie,
  1062. VARIANT* lpvarOut);
  1063. END_INTERFACE_PART_STATIC(PerPropertyBrowsing)
  1064. // IPropertyNotifySink for font updates (not exposed via QueryInterface)
  1065. BEGIN_INTERFACE_PART(FontNotification, IPropertyNotifySink)
  1066. INIT_INTERFACE_PART(COleControl, FontNotification)
  1067. STDMETHOD(OnChanged)(DISPID dispid);
  1068. STDMETHOD(OnRequestEdit)(DISPID dispid);
  1069. END_INTERFACE_PART_STATIC(FontNotification)
  1070. // IQuickActivate
  1071. BEGIN_INTERFACE_PART(QuickActivate, IQuickActivate)
  1072. STDMETHOD(QuickActivate)(QACONTAINER *pQAContainer, QACONTROL *pqacontrol);
  1073. STDMETHOD(SetContentExtent)(LPSIZEL lpsizel);
  1074. STDMETHOD(GetContentExtent)(LPSIZEL lpsizel);
  1075. END_INTERFACE_PART_STATIC(QuickActivate)
  1076. // IPointerInactive
  1077. BEGIN_INTERFACE_PART(PointerInactive, IPointerInactive)
  1078. STDMETHOD(GetActivationPolicy)(DWORD* pdwPolicy);
  1079. STDMETHOD(OnInactiveSetCursor)(LPCRECT lprcBounds, long x, long y,
  1080. DWORD dwMouseMsg, BOOL bSetAlways);
  1081. STDMETHOD(OnInactiveMouseMove)(LPCRECT lprcBounds, long x, long y,
  1082. DWORD dwKeyState);
  1083. END_INTERFACE_PART_STATIC(PointerInactive)
  1084. DECLARE_INTERFACE_MAP()
  1085. // Connection maps
  1086. protected:
  1087. // Connection point for events
  1088. BEGIN_CONNECTION_PART(COleControl, EventConnPt)
  1089. virtual void OnAdvise(BOOL bAdvise);
  1090. virtual REFIID GetIID();
  1091. virtual LPUNKNOWN QuerySinkInterface(LPUNKNOWN pUnkSink);
  1092. END_CONNECTION_PART(EventConnPt)
  1093. // Connection point for property notifications
  1094. BEGIN_CONNECTION_PART(COleControl, PropConnPt)
  1095. CONNECTION_IID(IID_IPropertyNotifySink)
  1096. END_CONNECTION_PART(PropConnPt)
  1097. DECLARE_CONNECTION_MAP()
  1098. };
  1099. /////////////////////////////////////////////////////////////////////////////
  1100. // Registry functions
  1101. enum AFX_REG_FLAGS
  1102. {
  1103. afxRegDefault = 0x0000,
  1104. afxRegInsertable = 0x0001,
  1105. afxRegApartmentThreading = 0x0002,
  1106. };
  1107. BOOL AFXAPI AfxOleRegisterTypeLib(HINSTANCE hInstance, REFGUID tlid,
  1108. LPCTSTR pszFileName = NULL, LPCTSTR pszHelpDir = NULL);
  1109. BOOL AFXAPI AfxOleUnregisterTypeLib(REFGUID tlid, WORD wVerMajor = 0,
  1110. WORD wVerMinor = 0, LCID lcid = 0);
  1111. BOOL AFXAPI AfxOleRegisterControlClass(HINSTANCE hInstance, REFCLSID clsid,
  1112. LPCTSTR pszProgID, UINT idTypeName, UINT idBitmap, int nRegFlags,
  1113. DWORD dwMiscStatus, REFGUID tlid, WORD wVerMajor, WORD wVerMinor);
  1114. BOOL AFXAPI AfxOleUnregisterClass(REFCLSID clsid, LPCTSTR pszProgID);
  1115. BOOL AFXAPI AfxOleRegisterPropertyPageClass(HINSTANCE hInstance,
  1116. REFCLSID clsid, UINT idTypeName);
  1117. BOOL AFXAPI AfxOleRegisterPropertyPageClass(HINSTANCE hInstance,
  1118. REFCLSID clsid, UINT idTypeName, int nRegFlags);
  1119. /////////////////////////////////////////////////////////////////////////////
  1120. // Licensing functions
  1121. BOOL AFXAPI AfxVerifyLicFile(HINSTANCE hInstance, LPCTSTR pszLicFileName,
  1122. LPCOLESTR pszLicFileContents, UINT cch=-1);
  1123. /////////////////////////////////////////////////////////////////////////////
  1124. // CPropExchange - Abstract base class for property exchange
  1125. #ifdef _AFXDLL
  1126. class CPropExchange
  1127. #else
  1128. class AFX_NOVTABLE CPropExchange
  1129. #endif
  1130. {
  1131. // Operations
  1132. public:
  1133. BOOL IsLoading();
  1134. DWORD GetVersion();
  1135. BOOL IsAsynchronous();
  1136. // FALSE -> Do Sync stuff, and start async stuff if possible
  1137. // TRUE -> Do not do Sync stuff. Always start Async stuff
  1138. virtual BOOL ExchangeVersion(DWORD& dwVersionLoaded, DWORD dwVersionDefault,
  1139. BOOL bConvert);
  1140. virtual BOOL ExchangeProp(LPCTSTR pszPropName, VARTYPE vtProp,
  1141. void* pvProp, const void* pvDefault = NULL) = 0;
  1142. virtual BOOL ExchangeBlobProp(LPCTSTR pszPropName, HGLOBAL* phBlob,
  1143. HGLOBAL hBlobDefault = NULL) = 0;
  1144. virtual BOOL ExchangeFontProp(LPCTSTR pszPropName, CFontHolder& font,
  1145. const FONTDESC* pFontDesc,
  1146. LPFONTDISP pFontDispAmbient) = 0;
  1147. virtual BOOL ExchangePersistentProp(LPCTSTR pszPropName,
  1148. LPUNKNOWN* ppUnk, REFIID iid, LPUNKNOWN pUnkDefault) = 0;
  1149. // Implementation
  1150. protected:
  1151. CPropExchange();
  1152. BOOL m_bLoading;
  1153. BOOL m_bAsync;
  1154. DWORD m_dwVersion;
  1155. };
  1156. /////////////////////////////////////////////////////////////////////////////
  1157. // Property-exchange (PX_) helper functions
  1158. BOOL AFX_CDECL PX_Short(CPropExchange* pPX, LPCTSTR pszPropName, short& sValue);
  1159. BOOL AFX_CDECL PX_Short(CPropExchange* pPX, LPCTSTR pszPropName, short& sValue,
  1160. short sDefault);
  1161. BOOL AFX_CDECL PX_UShort(CPropExchange* pPX, LPCTSTR pszPropName, USHORT& usValue);
  1162. BOOL AFX_CDECL PX_UShort(CPropExchange* pPX, LPCTSTR pszPropName, USHORT& usValue,
  1163. USHORT usDefault);
  1164. BOOL AFX_CDECL PX_Long(CPropExchange* pPX, LPCTSTR pszPropName, long& lValue);
  1165. BOOL AFX_CDECL PX_Long(CPropExchange* pPX, LPCTSTR pszPropName, long& lValue,
  1166. long lDefault);
  1167. BOOL AFX_CDECL PX_ULong(CPropExchange* pPX, LPCTSTR pszPropName, ULONG& ulValue);
  1168. BOOL AFX_CDECL PX_ULong(CPropExchange* pPX, LPCTSTR pszPropName, ULONG& ulValue,
  1169. ULONG ulDefault);
  1170. BOOL AFX_CDECL PX_Color(CPropExchange* pPX, LPCTSTR pszPropName, OLE_COLOR& clrValue);
  1171. BOOL AFX_CDECL PX_Color(CPropExchange* pPX, LPCTSTR pszPropName, OLE_COLOR& clrValue,
  1172. OLE_COLOR clrDefault);
  1173. BOOL AFX_CDECL PX_Bool(CPropExchange* pPX, LPCTSTR pszPropName, BOOL& bValue);
  1174. BOOL AFX_CDECL PX_Bool(CPropExchange* pPX, LPCTSTR pszPropName, BOOL& bValue,
  1175. BOOL bDefault);
  1176. BOOL AFX_CDECL PX_String(CPropExchange* pPX, LPCTSTR pszPropName, CString& strValue);
  1177. BOOL AFX_CDECL PX_String(CPropExchange* pPX, LPCTSTR pszPropName, CString& strValue,
  1178. const CString& strDefault);
  1179. BOOL AFX_CDECL PX_String(CPropExchange* pPX, LPCTSTR pszPropName, CString& strValue,
  1180. LPCTSTR lpszDefault);
  1181. BOOL AFX_CDECL PX_Currency(CPropExchange* pPX, LPCTSTR pszPropName, CY& cyValue);
  1182. BOOL AFX_CDECL PX_Currency(CPropExchange* pPX, LPCTSTR pszPropName, CY& cyValue,
  1183. CY cyDefault);
  1184. BOOL AFX_CDECL PX_Float(CPropExchange* pPX, LPCTSTR pszPropName, float& floatValue);
  1185. BOOL AFX_CDECL PX_Float(CPropExchange* pPX, LPCTSTR pszPropName, float& floatValue,
  1186. float floatDefault);
  1187. BOOL AFX_CDECL PX_Double(CPropExchange* pPX, LPCTSTR pszPropName, double& doubleValue);
  1188. BOOL AFX_CDECL PX_Double(CPropExchange* pPX, LPCTSTR pszPropName, double& doubleValue,
  1189. double doubleDefault);
  1190. BOOL AFX_CDECL PX_Blob(CPropExchange* pPX, LPCTSTR pszPropName, HGLOBAL& hBlob,
  1191. HGLOBAL hBlobDefault = NULL);
  1192. BOOL AFX_CDECL PX_Font(CPropExchange* pPX, LPCTSTR pszPropName, CFontHolder& font,
  1193. const FONTDESC* pFontDesc = NULL,
  1194. LPFONTDISP pFontDispAmbient = NULL);
  1195. BOOL AFX_CDECL PX_Picture(CPropExchange* pPX, LPCTSTR pszPropName,
  1196. CPictureHolder& pict);
  1197. BOOL AFX_CDECL PX_Picture(CPropExchange* pPX, LPCTSTR pszPropName,
  1198. CPictureHolder& pict, CPictureHolder& pictDefault);
  1199. BOOL AFX_CDECL PX_IUnknown(CPropExchange* pPX, LPCTSTR pszPropName, LPUNKNOWN& pUnk,
  1200. REFIID iid, LPUNKNOWN pUnkDefault = NULL);
  1201. BOOL AFX_CDECL PX_VBXFontConvert(CPropExchange* pPX, CFontHolder& font);
  1202. BOOL AFX_CDECL PX_DataPath(CPropExchange* pPX, LPCTSTR pszPropName,
  1203. CDataPathProperty& dataPathProp, LPCTSTR pszDefault = NULL);
  1204. BOOL AFX_CDECL PX_DataPath(CPropExchange* pPX, LPCTSTR pszPropName,
  1205. CDataPathProperty& dataPathProp, const CString& strDefault);
  1206. /////////////////////////////////////////////////////////////////////////////
  1207. // Structures used by COlePropertyPage
  1208. typedef struct tagAFX_PPFIELDSTATUS
  1209. {
  1210. UINT nID;
  1211. BOOL bDirty;
  1212. } AFX_PPFIELDSTATUS;
  1213. /////////////////////////////////////////////////////////////////////////////
  1214. // Property Page Dialog Class
  1215. #ifdef _AFXDLL
  1216. class COlePropertyPage : public CDialog
  1217. #else
  1218. class AFX_NOVTABLE COlePropertyPage : public CDialog
  1219. #endif
  1220. {
  1221. DECLARE_DYNAMIC(COlePropertyPage)
  1222. // Constructors
  1223. public:
  1224. COlePropertyPage(UINT idDlg, UINT idCaption);
  1225. // Operations
  1226. LPDISPATCH* GetObjectArray(ULONG* pnObjects);
  1227. void SetModifiedFlag(BOOL bModified = TRUE);
  1228. BOOL IsModified();
  1229. LPPROPERTYPAGESITE GetPageSite();
  1230. void SetDialogResource(HGLOBAL hDialog);
  1231. void SetPageName(LPCTSTR lpszPageName);
  1232. void SetHelpInfo(LPCTSTR lpszDocString, LPCTSTR lpszHelpFile = NULL,
  1233. DWORD dwHelpContext = 0);
  1234. BOOL GetControlStatus(UINT nID);
  1235. BOOL SetControlStatus(UINT nID, BOOL bDirty);
  1236. void IgnoreApply(UINT nID);
  1237. int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = NULL,
  1238. UINT nType = MB_OK);
  1239. // note that this is a non-virtual override of CWnd::MessageBox()
  1240. // Overridables
  1241. virtual void OnSetPageSite();
  1242. virtual void OnObjectsChanged();
  1243. virtual BOOL OnHelp(LPCTSTR lpszHelpDir);
  1244. virtual BOOL OnInitDialog();
  1245. virtual BOOL OnEditProperty(DISPID dispid);
  1246. // Implementation
  1247. // DDP_ property get/set helper routines
  1248. BOOL SetPropText(LPCTSTR pszPropName, BYTE &Value);
  1249. BOOL GetPropText(LPCTSTR pszPropName, BYTE* pValue);
  1250. BOOL SetPropText(LPCTSTR pszPropName, short &Value);
  1251. BOOL GetPropText(LPCTSTR pszPropName, short* pValue);
  1252. BOOL SetPropText(LPCTSTR pszPropName, int &Value);
  1253. BOOL GetPropText(LPCTSTR pszPropName, int* pValue);
  1254. BOOL SetPropText(LPCTSTR pszPropName, UINT &Value);
  1255. BOOL GetPropText(LPCTSTR pszPropName, UINT* pValue);
  1256. BOOL SetPropText(LPCTSTR pszPropName, long &Value);
  1257. BOOL GetPropText(LPCTSTR pszPropName, long* pValue);
  1258. BOOL SetPropText(LPCTSTR pszPropName, DWORD &Value);
  1259. BOOL GetPropText(LPCTSTR pszPropName, DWORD* pValue);
  1260. BOOL SetPropText(LPCTSTR pszPropName, CString &Value);
  1261. BOOL GetPropText(LPCTSTR pszPropName, CString* pValue);
  1262. BOOL SetPropText(LPCTSTR pszPropName, float &Value);
  1263. BOOL GetPropText(LPCTSTR pszPropName, float* pValue);
  1264. BOOL SetPropText(LPCTSTR pszPropName, double &Value);
  1265. BOOL GetPropText(LPCTSTR pszPropName, double* pValue);
  1266. BOOL SetPropCheck(LPCTSTR pszPropName, int Value);
  1267. BOOL GetPropCheck(LPCTSTR pszPropName, int* pValue);
  1268. BOOL SetPropRadio(LPCTSTR pszPropName, int Value);
  1269. BOOL GetPropRadio(LPCTSTR pszPropName, int* pValue);
  1270. BOOL SetPropIndex(LPCTSTR pszPropName, int Value);
  1271. BOOL GetPropIndex(LPCTSTR pszPropName, int* pValue);
  1272. CPtrArray m_arrayDDP; // pending DDP data
  1273. // Destructors
  1274. ~COlePropertyPage();
  1275. protected:
  1276. LRESULT WindowProc(UINT msg, WPARAM wParam, LPARAM lParam);
  1277. BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  1278. BOOL PreTranslateMessage(LPMSG lpMsg);
  1279. virtual void OnFinalRelease();
  1280. void CleanupObjectArray();
  1281. static BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam);
  1282. static BOOL CALLBACK EnumControls(HWND hWnd, LPARAM lParam);
  1283. private:
  1284. BOOL m_bDirty;
  1285. UINT m_idDlg;
  1286. UINT m_idCaption;
  1287. CString m_strPageName;
  1288. SIZE m_sizePage;
  1289. CString m_strDocString;
  1290. CString m_strHelpFile;
  1291. DWORD m_dwHelpContext;
  1292. LPPROPERTYPAGESITE m_pPageSite;
  1293. LPDISPATCH* m_ppDisp; // Array of IDispatch pointers, used to
  1294. // access the properties of each control
  1295. LPDWORD m_pAdvisors; // Array of connection tokens used by
  1296. // IConnecitonPoint::Advise/UnAdvise.
  1297. BOOL m_bPropsChanged; // IPropertyNotifySink::OnChanged has been
  1298. // called, but not acted upon yet.
  1299. ULONG m_nObjects; // Objects in m_ppDisp, m_ppDataObj, m_pAdvisors
  1300. BOOL m_bInitializing; // TRUE if the contents of the fields of
  1301. // the dialog box are being initialized
  1302. int m_nControls; // Number of fields on this property page
  1303. AFX_PPFIELDSTATUS* m_pStatus; // Array containing information on
  1304. // which fields are dirty
  1305. CDWordArray m_IDArray; // Array containing information on which
  1306. // controls to ignore when deciding if
  1307. // the apply button is to be enabled
  1308. HGLOBAL m_hDialog; // Handle of the dialog resource
  1309. #ifdef _DEBUG
  1310. protected:
  1311. BOOL m_bNonStandardSize;
  1312. #endif
  1313. protected:
  1314. // Generated message map functions
  1315. //{{AFX_MSG(COlePropertyPage)
  1316. afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  1317. //}}AFX_MSG
  1318. DECLARE_MESSAGE_MAP()
  1319. // Interface Maps
  1320. public:
  1321. BEGIN_INTERFACE_PART(PropertyPage, IPropertyPage2)
  1322. INIT_INTERFACE_PART(COlePropertyPage, PropertyPage)
  1323. STDMETHOD(SetPageSite)(LPPROPERTYPAGESITE);
  1324. STDMETHOD(Activate)(HWND, LPCRECT, BOOL);
  1325. STDMETHOD(Deactivate)();
  1326. STDMETHOD(GetPageInfo)(LPPROPPAGEINFO);
  1327. STDMETHOD(SetObjects)(ULONG, LPUNKNOWN*);
  1328. STDMETHOD(Show)(UINT);
  1329. STDMETHOD(Move)(LPCRECT);
  1330. STDMETHOD(IsPageDirty)();
  1331. STDMETHOD(Apply)();
  1332. STDMETHOD(Help)(LPCOLESTR);
  1333. STDMETHOD(TranslateAccelerator)(LPMSG);
  1334. STDMETHOD(EditProperty)(DISPID);
  1335. END_INTERFACE_PART(PropertyPage)
  1336. BEGIN_INTERFACE_PART(PropNotifySink, IPropertyNotifySink)
  1337. INIT_INTERFACE_PART(COlePropertyPage, PropNotifySink)
  1338. STDMETHOD(OnRequestEdit)(DISPID);
  1339. STDMETHOD(OnChanged)(DISPID);
  1340. END_INTERFACE_PART(PropNotifySink)
  1341. DECLARE_INTERFACE_MAP()
  1342. };
  1343. /////////////////////////////////////////////////////////////////////////////
  1344. // CStockPropPage
  1345. #ifdef _AFXDLL
  1346. class CStockPropPage : public COlePropertyPage
  1347. #else
  1348. class AFX_NOVTABLE CStockPropPage : public COlePropertyPage
  1349. #endif
  1350. {
  1351. DECLARE_DYNAMIC(CStockPropPage)
  1352. // Constructor
  1353. public:
  1354. CStockPropPage(UINT idDlg, UINT idCaption);
  1355. // Implementation
  1356. protected:
  1357. void FillPropnameList(REFGUID guid, int nIndirect, CComboBox& combo);
  1358. void OnSelchangePropname(CComboBox& combo);
  1359. BOOL OnEditProperty(DISPID dispid, CComboBox& combo);
  1360. LCID m_lcid;
  1361. CString m_strPropName;
  1362. int m_iPropName;
  1363. DECLARE_MESSAGE_MAP()
  1364. };
  1365. ///////////////////////////////////////////////////////////////////////////////
  1366. // CColorButton: used by CColorPropPage
  1367. class CColorButton : public CButton
  1368. {
  1369. public:
  1370. CColorButton(void);
  1371. void SetFaceColor(COLORREF colFace);
  1372. COLORREF colGetFaceColor(void);
  1373. void SetState(BOOL fSelected);
  1374. static UINT idClicked;
  1375. protected:
  1376. virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  1377. private:
  1378. BOOL m_fSelected;
  1379. COLORREF m_colFace;
  1380. };
  1381. /////////////////////////////////////////////////////////////////////////////
  1382. // CColorPropPage
  1383. class CColorPropPage : public CStockPropPage
  1384. {
  1385. DECLARE_DYNCREATE(CColorPropPage)
  1386. #ifdef _AFXDLL
  1387. DECLARE_OLECREATE_EX(CColorPropPage)
  1388. #endif
  1389. // Construction
  1390. public:
  1391. CColorPropPage(); // Constructor
  1392. // Dialog Data
  1393. //{{AFX_DATA(CColorPropPage)
  1394. enum { IDD = AFX_IDD_PROPPAGE_COLOR };
  1395. CComboBox m_SysColors;
  1396. CComboBox m_ColorProp;
  1397. //}}AFX_DATA
  1398. // Implementation
  1399. public:
  1400. enum { NBUTTONS = 16 };
  1401. protected:
  1402. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  1403. virtual BOOL OnInitDialog(void);
  1404. virtual BOOL OnEditProperty(DISPID dispid);
  1405. virtual void OnObjectsChanged();
  1406. void FillSysColors();
  1407. BOOL SetColorProp(CDataExchange* pDX, COLORREF color, LPCTSTR pszPropName);
  1408. BOOL GetColorProp(CDataExchange* pDX, COLORREF* pcolor, LPCTSTR pszPropName);
  1409. private:
  1410. CColorButton m_Buttons[NBUTTONS];
  1411. CColorButton *m_pSelectedButton;
  1412. void SetButton(CColorButton *Button);
  1413. // Generated message map functions
  1414. //{{AFX_MSG(CColorPropPage)
  1415. afx_msg void OnSelchangeColorprop();
  1416. afx_msg void OnSelect(void);
  1417. afx_msg void OnSelchangeSystemcolors();
  1418. //}}AFX_MSG
  1419. DECLARE_MESSAGE_MAP()
  1420. };
  1421. // Stores all the information about a font
  1422. typedef struct tagFONTOBJECT
  1423. {
  1424. CString strName;
  1425. CY cySize;
  1426. BOOL bBold;
  1427. BOOL bItalic;
  1428. BOOL bUnderline;
  1429. BOOL bStrikethrough;
  1430. short sWeight;
  1431. } FONTOBJECT;
  1432. // Merge objects are used when trying to consolidate multiple font properties.
  1433. // If the characteristics of these multiple properties differ then this is
  1434. // represented in the merge object.
  1435. typedef struct tagMERGEOBJECT
  1436. {
  1437. BOOL bNameOK;
  1438. BOOL bSizeOK;
  1439. BOOL bStyleOK;
  1440. BOOL bUnderlineOK;
  1441. BOOL bStrikethroughOK;
  1442. } MERGEOBJECT;
  1443. /////////////////////////////////////////////////////////////////////////////
  1444. // CSizeComboBox window
  1445. class CSizeComboBox : public CComboBox
  1446. {
  1447. // Operations
  1448. public:
  1449. int AddSize(int PointSize, LONG lfHeight);
  1450. void GetPointSize(CY& cy);
  1451. LONG GetHeight(int sel=-1);
  1452. void UpdateLogFont( LPLOGFONT lpLF, int sel=-1 );
  1453. };
  1454. /////////////////////////////////////////////////////////////////////////////
  1455. // CFontComboBox window
  1456. struct FONTITEM_PPG
  1457. {
  1458. DWORD dwFontType;
  1459. LOGFONT lf;
  1460. };
  1461. class CFontComboBox : public CComboBox
  1462. {
  1463. // Construction
  1464. public:
  1465. CFontComboBox();
  1466. virtual ~CFontComboBox();
  1467. // Operations
  1468. public:
  1469. int AddFont(LOGFONT *, DWORD);
  1470. CString GetCurrentName();
  1471. FONTITEM_PPG* GetFontItem(int sel=-1);
  1472. LPLOGFONT GetLogFont(int sel=-1);
  1473. DWORD GetFontType(int sel=-1);
  1474. // Implementation
  1475. public:
  1476. virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
  1477. virtual void DeleteItem(LPDELETEITEMSTRUCT lpDIS);
  1478. protected:
  1479. CBitmap m_bmpTrueType;
  1480. CBitmap m_bmpMask;
  1481. };
  1482. ///////////////////////////////////////////////////////////////////////////
  1483. // CFontPropPage class
  1484. class CFontPropPage : public CStockPropPage
  1485. {
  1486. DECLARE_DYNCREATE(CFontPropPage)
  1487. #ifdef _AFXDLL
  1488. DECLARE_OLECREATE_EX(CFontPropPage)
  1489. #endif
  1490. public:
  1491. CFontPropPage();
  1492. // Dialog Data
  1493. //{{AFX_DATA(CFontPropPage)
  1494. enum { IDD = AFX_IDD_PROPPAGE_FONT };
  1495. CComboBox m_FontProp;
  1496. CStatic m_SampleBox;
  1497. CComboBox m_FontStyles;
  1498. CSizeComboBox m_FontSizes;
  1499. CFontComboBox m_FontNames;
  1500. //}}AFX_DATA
  1501. // Attributes
  1502. protected:
  1503. int nPixelsY;
  1504. CFont SampleFont;
  1505. DWORD m_nCurrentStyle;
  1506. DWORD m_nActualStyle;
  1507. DWORD m_nStyles;
  1508. BOOL m_bStrikeOut;
  1509. BOOL m_bUnderline;
  1510. CString m_strFontSize;
  1511. // Implementation
  1512. protected:
  1513. void FillFacenameList();
  1514. void FillSizeList();
  1515. virtual void DoDataExchange(CDataExchange* pDX);
  1516. virtual void OnPaint();
  1517. virtual BOOL OnEditProperty(DISPID dispid);
  1518. virtual void OnObjectsChanged();
  1519. void UpdateSampleFont();
  1520. void SelectFontFromList(CString strFaceName, MERGEOBJECT* pmobj);
  1521. //{{AFX_MSG(CFontPropPage)
  1522. virtual BOOL OnInitDialog();
  1523. afx_msg void OnEditupdateFontnames();
  1524. afx_msg void OnEditupdateFontsizes();
  1525. afx_msg void OnSelchangeFontnames();
  1526. afx_msg void OnSelchangeFontsizes();
  1527. afx_msg void OnSelchangeFontstyles();
  1528. afx_msg void OnEditchangeFontstyles();
  1529. afx_msg void OnStrikeout();
  1530. afx_msg void OnUnderline();
  1531. afx_msg void OnSelchangeFontprop();
  1532. //}}AFX_MSG
  1533. DECLARE_MESSAGE_MAP()
  1534. static int CALLBACK EnumFontFamiliesCallBack(ENUMLOGFONT* lpelf, NEWTEXTMETRIC* lpntm, int FontType, LPARAM lParam);
  1535. static int CALLBACK EnumFontFamiliesCallBack2(ENUMLOGFONT* lpelf, NEWTEXTMETRIC* lpntm, int FontType, LPARAM lParam);
  1536. BOOL SetFontProps(CDataExchange* pDX, FONTOBJECT fobj, LPCTSTR pszPropName);
  1537. BOOL GetFontProps(CDataExchange* pDX, FONTOBJECT* pfobj, LPCTSTR pszPropName, MERGEOBJECT* pmobj);
  1538. };
  1539. ////////////////////////////////////////////////////////////////////////////
  1540. // CPicturePropPage
  1541. class CPicturePropPage : public CStockPropPage
  1542. {
  1543. DECLARE_DYNCREATE(CPicturePropPage)
  1544. #ifdef _AFXDLL
  1545. DECLARE_OLECREATE_EX(CPicturePropPage)
  1546. #endif
  1547. // Construction
  1548. public:
  1549. CPicturePropPage(); // standard constructor
  1550. ~CPicturePropPage();
  1551. // Dialog Data
  1552. //{{AFX_DATA(CPicturePropPage)
  1553. enum { IDD = AFX_IDD_PROPPAGE_PICTURE };
  1554. CComboBox m_PropName;
  1555. CStatic m_Static;
  1556. //}}AFX_DATA
  1557. // Implementation
  1558. protected:
  1559. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  1560. virtual BOOL OnInitDialog(void);
  1561. virtual BOOL OnEditProperty(DISPID dispid);
  1562. virtual void OnObjectsChanged();
  1563. BOOL SetPictureProp(CDataExchange* pDX, LPPICTUREDISP pPictDisp, LPCTSTR pszPropName);
  1564. BOOL GetPictureProp(CDataExchange* pDX, LPPICTUREDISP* ppPictDisp, LPCTSTR pszPropName);
  1565. void ChangePicture(LPPICTURE pPict);
  1566. LPPICTUREDISP m_pPictDisp;
  1567. // Generated message map functions
  1568. protected:
  1569. //{{AFX_MSG(CPicturePropPage)
  1570. afx_msg void OnPaint();
  1571. afx_msg void OnBrowse();
  1572. afx_msg void OnClear();
  1573. afx_msg void OnSelchangePictProp();
  1574. //}}AFX_MSG
  1575. DECLARE_MESSAGE_MAP()
  1576. };
  1577. /////////////////////////////////////////////////////////////////////////////
  1578. // Property Page Dialog Data Exchange routines
  1579. // simple text operations
  1580. void AFXAPI DDP_Text(CDataExchange*pDX, int id, BYTE& member, LPCTSTR pszPropName);
  1581. void AFXAPI DDP_Text(CDataExchange*pDX, int id, short& member, LPCTSTR pszPropName);
  1582. void AFXAPI DDP_Text(CDataExchange*pDX, int id, int& member, LPCTSTR pszPropName);
  1583. void AFXAPI DDP_Text(CDataExchange*pDX, int id, UINT& member, LPCTSTR pszPropName);
  1584. void AFXAPI DDP_Text(CDataExchange*pDX, int id, long& member, LPCTSTR pszPropName);
  1585. void AFXAPI DDP_Text(CDataExchange*pDX, int id, DWORD& member, LPCTSTR pszPropName);
  1586. void AFXAPI DDP_Text(CDataExchange*pDX, int id, float& member, LPCTSTR pszPropName);
  1587. void AFXAPI DDP_Text(CDataExchange*pDX, int id, double& member, LPCTSTR pszPropName);
  1588. void AFXAPI DDP_Text(CDataExchange*pDX, int id, CString& member, LPCTSTR pszPropName);
  1589. void AFXAPI DDP_Check(CDataExchange*pDX, int id, int& member, LPCTSTR pszPropName);
  1590. void AFXAPI DDP_Radio(CDataExchange*pDX, int id, int& member, LPCTSTR pszPropName);
  1591. void AFXAPI DDP_LBString(CDataExchange* pDX, int id, CString& member, LPCTSTR pszPropName);
  1592. void AFXAPI DDP_LBStringExact(CDataExchange* pDX, int id, CString& member, LPCTSTR pszPropName);
  1593. void AFXAPI DDP_LBIndex(CDataExchange* pDX, int id, int& member, LPCTSTR pszPropName);
  1594. void AFXAPI DDP_CBString(CDataExchange* pDX, int id, CString& member, LPCTSTR pszPropName);
  1595. void AFXAPI DDP_CBStringExact(CDataExchange* pDX, int id, CString& member, LPCTSTR pszPropName);
  1596. void AFXAPI DDP_CBIndex(CDataExchange* pDX, int id, int& member, LPCTSTR pszPropName);
  1597. void AFXAPI DDP_PostProcessing(CDataExchange *pDX);
  1598. ////////////////////////////////////////////////////////////////////////////
  1599. // AfxOleTypeMatchGuid - Tests whether a given TYPEDESC matches a type with a
  1600. // given GUID, when all aliases have been expanded.
  1601. BOOL AFXAPI AfxOleTypeMatchGuid(LPTYPEINFO pTypeInfo,
  1602. TYPEDESC* pTypeDesc, REFGUID guidType, ULONG cIndirectionLevels);
  1603. /////////////////////////////////////////////////////////////////////////////
  1604. // Inline function declarations
  1605. #ifdef _AFX_PACKING
  1606. #pragma pack(pop)
  1607. #endif
  1608. #ifdef _AFX_ENABLE_INLINES
  1609. #define _AFXCTL_INLINE AFX_INLINE
  1610. #include <afxctl.inl>
  1611. #endif
  1612. #undef AFX_DATA
  1613. #define AFX_DATA
  1614. #ifdef _AFX_MINREBUILD
  1615. #pragma component(minrebuild, on)
  1616. #endif
  1617. #ifndef _AFX_FULLTYPEINFO
  1618. #pragma component(mintypeinfo, off)
  1619. #endif
  1620. #endif // __AFXCTL_H__
  1621. /////////////////////////////////////////////////////////////////////////////