Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1118 lines
36 KiB

  1. /*++
  2. Copyright (C) 1993-1999 Microsoft Corporation
  3. Module Name:
  4. polyline.h
  5. Abstract:
  6. Definitions and function prototypes
  7. --*/
  8. #ifndef _POLYLINE_H_
  9. #define _POLYLINE_H_
  10. #define USE_SAMPLE_IPOLYLIN10
  11. #define GUIDS_FROM_TYPELIB
  12. //
  13. // Define the macro so that we don't include StringCbXXXX functions
  14. //
  15. #define STRSAFE_NO_CB_FUNCTIONS
  16. #include <windows.h>
  17. #include <ole2.h>
  18. #include <olectl.h>
  19. #include <objsafe.h>
  20. #include <tchar.h>
  21. #include <assert.h>
  22. #include <strsafe.h>
  23. #ifdef INITGUIDS
  24. #include <initguid.h>
  25. #endif
  26. #ifndef PPVOID
  27. typedef LPVOID * PPVOID;
  28. #endif
  29. //
  30. // ??? Why use this
  31. //
  32. #define CFSTR_EMBEDSOURCE L"Embed Source"
  33. //Type for an object-destroyed callback
  34. typedef void (*PFNDESTROYED)(void);
  35. typedef enum {
  36. PSSTATE_UNINIT, //Uninitialized
  37. PSSTATE_SCRIBBLE, //Scribble
  38. PSSTATE_ZOMBIE, //No scribble
  39. PSSTATE_HANDSOFF //Hand-off
  40. } PSSTATE;
  41. //
  42. //DeleteInterfaceImp calls 'delete' and NULLs the pointer
  43. //
  44. #define DeleteInterfaceImp(p) \
  45. { \
  46. if (NULL != p) { \
  47. delete p; \
  48. p = NULL; \
  49. } \
  50. }
  51. //
  52. // ReleaseInterface calls 'Release' method
  53. //
  54. // TODO: Hong investigate all the places where ReleaseInterface is used.
  55. // And remove the "p = NULL" code.
  56. //
  57. #define ReleaseInterface(p) \
  58. { \
  59. if (NULL!=p) { \
  60. p->Release(); \
  61. p = NULL; \
  62. } \
  63. }
  64. //
  65. // ClearInterface calls 'Release' method and NULLs the pointer
  66. //
  67. #define ClearInterface(p) \
  68. { \
  69. if (NULL != p) { \
  70. p->Release(); \
  71. p = NULL; \
  72. } \
  73. }
  74. #define SETNOPARAMS(dp) SETDISPPARAMS(dp, 0, NULL, 0, NULL)
  75. //
  76. //Macros for setting DISPPARAMS structures
  77. //
  78. #define SETDISPPARAMS(dp, numArgs, pvArgs, numNamed, pNamed) \
  79. { \
  80. (dp).cArgs =numArgs; \
  81. (dp).rgvarg = pvArgs; \
  82. (dp).cNamedArgs = numNamed; \
  83. (dp).rgdispidNamedArgs = pNamed; \
  84. }
  85. #include "isysmon.h" //From MKTYPLIB
  86. //
  87. // Forward class declaration
  88. //
  89. class CPolyline;
  90. class CImpIObjectSafety;
  91. class CImpIPersistStorage;
  92. class CImpIPersistStreamInit;
  93. class CImpIPersistPropertyBag;
  94. class CImpIPerPropertyBrowsing;
  95. class CImpIDataObject;
  96. class CImpIOleObject;
  97. class CImpIViewObject;
  98. class CImpIRunnableObject;
  99. class CImpIExternalConnection;
  100. class CImpIOleInPlaceObject;
  101. class CImpIOleInPlaceActiveObject;
  102. class CImpISpecifyPP;
  103. class CImpIProvideClassInfo;
  104. class CImpIDispatch;
  105. class CImpISystemMonitor;
  106. class CImpIOleControl;
  107. class CAdviseRouter;
  108. class CGraphItem;
  109. #ifdef USE_SAMPLE_IPOLYLIN10
  110. #include "ipoly10.h"
  111. class CImpIPolyline;
  112. typedef CImpIPolyline* PCImpIPolyline;
  113. #endif
  114. typedef class CPolyline *PCPolyline;
  115. typedef class CImpIObjectSafety* PCImpIObjectSafety;
  116. typedef class CImpIPersistStorage* PCImpIPersistStorage;
  117. typedef class CImpIPersistStreamInit* PCImpIPersistStreamInit;
  118. typedef class CImpIPersistPropertyBag* PCImpIPersistPropertyBag;
  119. typedef class CImpIPerPropertyBrowsing* PCImpIPerPropertyBrowsing;
  120. typedef class CImpIDataObject* PCImpIDataObject;
  121. typedef class CEnumFormatEtc* PCEnumFormatEtc;
  122. typedef class CImpIOleObject* PCImpIOleObject;
  123. typedef class CImpIViewObject* PCImpIViewObject;
  124. typedef class CImpIRunnableObject* PCImpIRunnableObject;
  125. typedef class CImpIExternalConnection* PCImpIExternalConnection;
  126. typedef class CImpIOleInPlaceObject* PCImpIOleInPlaceObject;
  127. typedef class CImpIOleInPlaceActiveObject* PCImpIOleInPlaceActiveObject;
  128. typedef class CImpISpecifyPP* PCImpISpecifyPP;
  129. typedef class CImpIProvideClassInfo* PCImpIProvideClassInfo;
  130. typedef class CImpIDispatch* PCImpIDispatch;
  131. typedef class CImpISystemMonitor* PCImpISystemMonitor;
  132. typedef class CImpIOleControl* PCImpIOleControl;
  133. typedef class CGraphItem* PCGraphItem;
  134. #include "resource.h"
  135. #include "strids.h"
  136. #include "iconnpt.h"
  137. #include "graph.h"
  138. #include "smonctrl.h"
  139. #include "globals.h"
  140. #include "utils.h"
  141. #include "hatchwnd.h"
  142. #include "logfiles.h"
  143. #include "counters.h"
  144. //
  145. // SYSMON clipboard format
  146. //
  147. #define SZSYSMONCLIPFORMAT TEXT("SYSTEM_MONITOR_CONFIGURATION")
  148. //
  149. //
  150. //
  151. #define LCID_SCRIPT 0x0409
  152. //
  153. // Stream Name that holds the data
  154. //
  155. #define SZSTREAM OLESTR("CONTENTS")
  156. //
  157. // Magic number to add to aspects returned from IViewObject::Freeze
  158. //
  159. #define FREEZE_KEY_OFFSET 0x0723
  160. #define HIMETRIC_PER_INCH 2540
  161. #define ID_HATCHWINDOW 2000
  162. //
  163. //This class factory object creates Polyline objects.
  164. //
  165. class CPolylineClassFactory : public IClassFactory
  166. {
  167. protected:
  168. ULONG m_cRef;
  169. public:
  170. CPolylineClassFactory(void);
  171. virtual ~CPolylineClassFactory(void);
  172. //IUnknown members
  173. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  174. STDMETHODIMP_(ULONG) AddRef(void);
  175. STDMETHODIMP_(ULONG) Release(void);
  176. //IClassFactory members
  177. STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, PPVOID);
  178. STDMETHODIMP LockServer(BOOL);
  179. };
  180. typedef CPolylineClassFactory *PCPolylineClassFactory;
  181. // Polyline Class
  182. class CPolyline : public IUnknown
  183. {
  184. friend LRESULT APIENTRY SysmonCtrlWndProc (HWND, UINT, WPARAM, LPARAM);
  185. friend class CImpIObjectSafety;
  186. friend class CImpIConnPtCont;
  187. friend class CImpIConnectionPoint;
  188. friend class CImpIPersistStorage;
  189. friend class CImpIPersistStreamInit;
  190. friend class CImpIPersistPropertyBag;
  191. friend class CImpIPerPropertyBrowsing;
  192. friend class CImpIDataObject;
  193. friend class CImpIOleObject;
  194. friend class CImpIViewObject;
  195. friend class CImpIRunnableObject;
  196. friend class CImpIExternalConnection;
  197. friend class CImpIOleInPlaceObject;
  198. friend class CImpIOleInPlaceActiveObject;
  199. friend class CSysmonControl;
  200. friend class CSysmonToolbar;
  201. friend class CGraphDisp;
  202. friend class CImpICounters;
  203. friend class CImpILogFiles;
  204. friend class CImpISpecifyPP;
  205. friend class CImpIProvideClassInfo;
  206. friend class CImpIDispatch;
  207. friend class CImpISystemMonitor;
  208. friend class CImpIOleControl;
  209. friend class CAdviseRouter;
  210. #ifdef USE_SAMPLE_IPOLYLIN10
  211. friend class CImpIPolyline;
  212. #endif
  213. protected:
  214. ULONG m_cRef; //Object reference count
  215. LPUNKNOWN m_pUnkOuter; //Controlling Unknown
  216. PFNDESTROYED m_pfnDestroy; //Function called on closure
  217. BOOL m_fDirty; //Have we changed?
  218. GRAPHDATA m_Graph; //Graph data
  219. PSYSMONCTRL m_pCtrl; //Sysmon Control object
  220. RECT m_RectExt; //Extent rectangle
  221. //Contained interfaces
  222. #ifdef USE_SAMPLE_IPOLYLIN10
  223. PCImpIPolyline m_pImpIPolyline;
  224. #endif
  225. PCImpIConnPtCont m_pImpIConnPtCont;
  226. PCImpIPersistStorage m_pImpIPersistStorage;
  227. PCImpIPersistStreamInit m_pImpIPersistStreamInit;
  228. PCImpIPersistPropertyBag m_pImpIPersistPropertyBag;
  229. PCImpIPerPropertyBrowsing m_pImpIPerPropertyBrowsing;
  230. PCImpIDataObject m_pImpIDataObject;
  231. // Connection point holders (direct & dispatch)
  232. CImpIConnectionPoint m_ConnectionPoint[CONNECTION_POINT_CNT];
  233. CLIPFORMAT m_cf; //Object clipboard format
  234. CLSID m_clsID; //Current CLSID
  235. //We have to hold these for IPersistStorage::Save
  236. LPSTORAGE m_pIStorage;
  237. LPSTREAM m_pIStream;
  238. LPDATAADVISEHOLDER m_pIDataAdviseHolder;
  239. //These are default handler interfaces we use
  240. LPUNKNOWN m_pDefIUnknown;
  241. LPVIEWOBJECT2 m_pDefIViewObject;
  242. LPPERSISTSTORAGE m_pDefIPersistStorage;
  243. LPDATAOBJECT m_pDefIDataObject;
  244. //Implemented and used interfaces
  245. PCImpIObjectSafety m_pImpIObjectSafety;
  246. PCImpIOleObject m_pImpIOleObject; //Implemented
  247. LPOLEADVISEHOLDER m_pIOleAdviseHolder; //Used
  248. LPOLECLIENTSITE m_pIOleClientSite; //Used
  249. PCImpIViewObject m_pImpIViewObject; //Implemented
  250. LPADVISESINK m_pIAdviseSink; //Used
  251. DWORD m_dwFrozenAspects; //Freeze
  252. DWORD m_dwAdviseAspects; //SetAdvise
  253. DWORD m_dwAdviseFlags; //SetAdvise
  254. PCImpIRunnableObject m_pImpIRunnableObject; //Implemented
  255. BOOL m_bIsRunning; // Running?
  256. HWND m_hDlg; //Editing window
  257. // PCImpIExternalConnection m_pImpIExternalConnection; //Implemented
  258. BOOL m_fLockContainer;
  259. DWORD m_dwRegROT;
  260. LPOLEINPLACESITE m_pIOleIPSite;
  261. LPOLEINPLACEFRAME m_pIOleIPFrame;
  262. LPOLEINPLACEUIWINDOW m_pIOleIPUIWindow;
  263. PCImpIOleInPlaceObject m_pImpIOleIPObject;
  264. PCImpIOleInPlaceActiveObject m_pImpIOleIPActiveObject;
  265. HMENU m_hMenuShared;
  266. HOLEMENU m_hOLEMenu;
  267. PCHatchWin m_pHW;
  268. BOOL m_fAllowInPlace;
  269. BOOL m_fUIActive;
  270. BOOL m_fContainerKnowsInsideOut;
  271. PCImpISpecifyPP m_pImpISpecifyPP;
  272. PCImpIProvideClassInfo m_pImpIProvideClassInfo;
  273. PCImpIDispatch m_pImpIDispatch;
  274. PCImpISystemMonitor m_pImpISystemMonitor;
  275. PCImpIOleControl m_pImpIOleControl;
  276. PCImpICounters m_pImpICounters;
  277. PCImpILogFiles m_pImpILogFiles;
  278. //Our own type lib for the object
  279. ITypeLib *m_pITypeLib;
  280. //From the container;
  281. IOleControlSite *m_pIOleControlSite;
  282. IDispatch *m_pIDispatchAmbients;
  283. BOOL m_fFreezeEvents;
  284. CONTROLINFO m_ctrlInfo;
  285. //Other ambients
  286. BOOL m_fHatch;
  287. protected:
  288. void PointScale(LPRECT, LPPOINTS, BOOL);
  289. void Draw(HDC, HDC, BOOL, BOOL, LPRECT);
  290. void SendAdvise(UINT);
  291. void SendEvent(UINT, DWORD);
  292. void RectConvertMappings(LPRECT, BOOL);
  293. /*
  294. * These members pulled from IPolyline now serve as a
  295. * central store for this functionality to be used from
  296. * other interfaces like IPersistStorage and IDataObject.
  297. * Other interfaces later may also use them.
  298. */
  299. STDMETHODIMP RenderBitmap(HBITMAP *, HDC hAttribDC);
  300. STDMETHODIMP RenderMetafilePict(HGLOBAL *, HDC hAttribDC);
  301. public:
  302. static RegisterWndClass(HINSTANCE hInst);
  303. CPolyline(LPUNKNOWN, PFNDESTROYED);
  304. virtual ~CPolyline(void);
  305. BOOL Init(void);
  306. //Non-delegating object IUnknown
  307. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  308. STDMETHODIMP_(ULONG) AddRef(void);
  309. STDMETHODIMP_(ULONG) Release(void);
  310. HRESULT InPlaceActivate(LPOLECLIENTSITE, BOOL);
  311. void InPlaceDeactivate(void);
  312. HRESULT UIActivate(void);
  313. void UIDeactivate(void);
  314. BOOL AmbientGet(DISPID, VARIANT *);
  315. void AmbientsInitialize(DWORD);
  316. };
  317. //Codes for CPolyline::SendAdvise
  318. //......Code.....................Method called in CPolyline::SendAdvise
  319. #define OBJECTCODE_SAVED 0 //IOleAdviseHolder::SendOnSave
  320. #define OBJECTCODE_CLOSED 1 //IOleAdviseHolder::SendOnClose
  321. #define OBJECTCODE_RENAMED 2 //IOleAdviseHolder::SendOnRename
  322. #define OBJECTCODE_SAVEOBJECT 3 //IOleClientSite::SaveObject
  323. #define OBJECTCODE_DATACHANGED 4 //IDataAdviseHolder::SendOnDataChange
  324. #define OBJECTCODE_SHOWWINDOW 5 //IOleClientSite::OnShowWindow(TRUE)
  325. #define OBJECTCODE_HIDEWINDOW 6 //IOleClientSite::OnShowWindow(FALSE)
  326. #define OBJECTCODE_SHOWOBJECT 7 //IOleClientSite::ShowObject
  327. //Flags for AmbientsInitialize
  328. enum
  329. {
  330. INITAMBIENT_SHOWHATCHING = 0x00000001,
  331. INITAMBIENT_UIDEAD = 0x00000002,
  332. INITAMBIENT_BACKCOLOR = 0x00000004,
  333. INITAMBIENT_FORECOLOR = 0x00000008,
  334. INITAMBIENT_FONT = 0x00000010,
  335. INITAMBIENT_APPEARANCE = 0x00000020,
  336. INITAMBIENT_USERMODE = 0x00000040,
  337. INITAMBIENT_RTL = 0x00000080,
  338. INITAMBIENT_ALL = 0xFFFFFFFF
  339. };
  340. #ifdef USE_SAMPLE_IPOLYLIN10
  341. //
  342. // Hong
  343. //
  344. //Interface implementation contained in the Polyline.
  345. class CImpIPolyline : public IPolyline10
  346. {
  347. protected:
  348. ULONG m_cRef; //Interface reference count
  349. PCPolyline m_pObj; //Back pointer to object
  350. LPUNKNOWN m_pUnkOuter; //Controlling unknown
  351. public:
  352. CImpIPolyline(PCPolyline, LPUNKNOWN);
  353. virtual ~CImpIPolyline(void);
  354. //IUnknown members.
  355. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  356. STDMETHODIMP_(ULONG) AddRef(void);
  357. STDMETHODIMP_(ULONG) Release(void);
  358. //Manipulation members:
  359. STDMETHODIMP Init(HWND, LPRECT, DWORD, UINT);
  360. STDMETHODIMP New(void);
  361. STDMETHODIMP Undo(void);
  362. STDMETHODIMP Window(HWND *);
  363. STDMETHODIMP RectGet(LPRECT);
  364. STDMETHODIMP SizeGet(LPRECT);
  365. STDMETHODIMP RectSet(LPRECT, BOOL);
  366. STDMETHODIMP SizeSet(LPRECT, BOOL);
  367. };
  368. typedef class CImpIPolyline* PCImpIPolyline;
  369. #endif
  370. class CImpIObjectSafety : public IObjectSafety
  371. {
  372. protected:
  373. ULONG m_cRef; //Interface reference count
  374. PCPolyline m_pObj; //Back pointer to object
  375. LPUNKNOWN m_pUnkOuter; //Controlling unknown
  376. private:
  377. BOOL m_fMessageDisplayed;
  378. VOID SetupSecurityPolicy();
  379. public:
  380. CImpIObjectSafety(PCPolyline, LPUNKNOWN);
  381. virtual ~CImpIObjectSafety(void);
  382. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  383. STDMETHODIMP_(ULONG) AddRef(void);
  384. STDMETHODIMP_(ULONG) Release(void);
  385. STDMETHODIMP GetInterfaceSafetyOptions(REFIID riid,
  386. DWORD* pdwSupportedOptions,
  387. DWORD* pdwEnabledOptions);
  388. STDMETHODIMP SetInterfaceSafetyOptions(REFIID riid,
  389. DWORD dwOptionSetMask,
  390. DWORD dwEnabledOptions);
  391. };
  392. class CImpIPersistStorage : public IPersistStorage
  393. {
  394. protected:
  395. ULONG m_cRef; //Interface reference count
  396. PCPolyline m_pObj; //Back pointer to object
  397. LPUNKNOWN m_pUnkOuter; //Controlling unknown
  398. PSSTATE m_psState; //Storage state
  399. public:
  400. CImpIPersistStorage(PCPolyline, LPUNKNOWN);
  401. virtual ~CImpIPersistStorage(void);
  402. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  403. STDMETHODIMP_(ULONG) AddRef(void);
  404. STDMETHODIMP_(ULONG) Release(void);
  405. STDMETHODIMP GetClassID(LPCLSID);
  406. STDMETHODIMP IsDirty(void);
  407. STDMETHODIMP InitNew(LPSTORAGE);
  408. STDMETHODIMP Load(LPSTORAGE);
  409. STDMETHODIMP Save(LPSTORAGE, BOOL);
  410. STDMETHODIMP SaveCompleted(LPSTORAGE);
  411. STDMETHODIMP HandsOffStorage(void);
  412. };
  413. //IPERSTMI.CPP
  414. class CImpIPersistStreamInit : public IPersistStreamInit
  415. {
  416. protected:
  417. ULONG m_cRef; //Interface reference count
  418. PCPolyline m_pObj; //Back pointer to object
  419. LPUNKNOWN m_pUnkOuter; //Controlling unknown
  420. public:
  421. CImpIPersistStreamInit(PCPolyline, LPUNKNOWN);
  422. virtual ~CImpIPersistStreamInit(void);
  423. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  424. STDMETHODIMP_(ULONG) AddRef(void);
  425. STDMETHODIMP_(ULONG) Release(void);
  426. STDMETHODIMP GetClassID(LPCLSID);
  427. STDMETHODIMP IsDirty(void);
  428. STDMETHODIMP Load(LPSTREAM);
  429. STDMETHODIMP Save(LPSTREAM, BOOL);
  430. STDMETHODIMP GetSizeMax(ULARGE_INTEGER *);
  431. STDMETHODIMP InitNew(void);
  432. };
  433. //IPERPBAG.CPP
  434. class CImpIPersistPropertyBag : public IPersistPropertyBag
  435. {
  436. protected:
  437. ULONG m_cRef; //Interface reference count
  438. PCPolyline m_pObj; //Back pointer to object
  439. LPUNKNOWN m_pUnkOuter; //Controlling unknown
  440. public:
  441. CImpIPersistPropertyBag(PCPolyline, LPUNKNOWN);
  442. virtual ~CImpIPersistPropertyBag(void);
  443. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  444. STDMETHODIMP_(ULONG) AddRef(void);
  445. STDMETHODIMP_(ULONG) Release(void);
  446. STDMETHODIMP GetClassID(LPCLSID);
  447. STDMETHODIMP InitNew(void);
  448. STDMETHODIMP Load(IPropertyBag*, IErrorLog*);
  449. STDMETHODIMP Save(IPropertyBag*, BOOL, BOOL);
  450. };
  451. //IPRPBRWS.CPP
  452. class CImpIPerPropertyBrowsing : public IPerPropertyBrowsing
  453. {
  454. protected:
  455. ULONG m_cRef; //Interface reference count
  456. PCPolyline m_pObj; //Back pointer to object
  457. LPUNKNOWN m_pUnkOuter; //Controlling unknown
  458. public:
  459. CImpIPerPropertyBrowsing(PCPolyline, LPUNKNOWN);
  460. virtual ~CImpIPerPropertyBrowsing(void);
  461. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  462. STDMETHODIMP_(ULONG) AddRef(void);
  463. STDMETHODIMP_(ULONG) Release(void);
  464. STDMETHODIMP GetClassID(LPCLSID);
  465. STDMETHODIMP GetDisplayString( DISPID, BSTR* );
  466. STDMETHODIMP GetPredefinedStrings( DISPID, CALPOLESTR*, CADWORD* );
  467. STDMETHODIMP GetPredefinedValue( DISPID, DWORD, VARIANT* );
  468. STDMETHODIMP MapPropertyToPage( DISPID, CLSID* );
  469. };
  470. //IDATAOBJ.CPP
  471. class CImpIDataObject : public IDataObject
  472. {
  473. private:
  474. ULONG m_cRef; //Interface reference count
  475. PCPolyline m_pObj; //Back pointer to object
  476. LPUNKNOWN m_pUnkOuter; //Controlling unknown
  477. public:
  478. CImpIDataObject(PCPolyline, LPUNKNOWN);
  479. virtual ~CImpIDataObject(void);
  480. //IUnknown members that delegate to m_pUnkOuter.
  481. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  482. STDMETHODIMP_(ULONG) AddRef(void);
  483. STDMETHODIMP_(ULONG) Release(void);
  484. //IDataObject members
  485. STDMETHODIMP GetData(LPFORMATETC, LPSTGMEDIUM);
  486. STDMETHODIMP GetDataHere(LPFORMATETC, LPSTGMEDIUM);
  487. STDMETHODIMP QueryGetData(LPFORMATETC);
  488. STDMETHODIMP GetCanonicalFormatEtc(LPFORMATETC,LPFORMATETC);
  489. STDMETHODIMP SetData(LPFORMATETC, LPSTGMEDIUM, BOOL);
  490. STDMETHODIMP EnumFormatEtc(DWORD, LPENUMFORMATETC *);
  491. STDMETHODIMP DAdvise(LPFORMATETC, DWORD, LPADVISESINK
  492. , DWORD *);
  493. STDMETHODIMP DUnadvise(DWORD);
  494. STDMETHODIMP EnumDAdvise(LPENUMSTATDATA *);
  495. };
  496. //IENUMFE.CPP
  497. class CEnumFormatEtc : public IEnumFORMATETC
  498. {
  499. private:
  500. ULONG m_cRef;
  501. LPUNKNOWN m_pUnkRef;
  502. ULONG m_iCur;
  503. ULONG m_cfe;
  504. LPFORMATETC m_prgfe;
  505. public:
  506. CEnumFormatEtc(LPUNKNOWN, ULONG, LPFORMATETC);
  507. virtual ~CEnumFormatEtc(void);
  508. //IUnknown members that delegate to m_pUnkRef.
  509. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  510. STDMETHODIMP_(ULONG) AddRef(void);
  511. STDMETHODIMP_(ULONG) Release(void);
  512. //IEnumFORMATETC members
  513. STDMETHODIMP Next(ULONG, LPFORMATETC, ULONG *);
  514. STDMETHODIMP Skip(ULONG);
  515. STDMETHODIMP Reset(void);
  516. STDMETHODIMP Clone(IEnumFORMATETC **);
  517. };
  518. //Our own properties verb
  519. #define POLYLINEVERB_PROPERTIES 1
  520. class CImpIOleObject : public IOleObject
  521. {
  522. private:
  523. ULONG m_cRef;
  524. PCPolyline m_pObj;
  525. LPUNKNOWN m_pUnkOuter;
  526. BOOL SafeForScripting();
  527. public:
  528. CImpIOleObject(PCPolyline, LPUNKNOWN);
  529. virtual ~CImpIOleObject(void);
  530. //IUnknown members that delegate to m_pUnkOuter.
  531. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  532. STDMETHODIMP_(ULONG) AddRef(void);
  533. STDMETHODIMP_(ULONG) Release(void);
  534. //IOleObject members
  535. STDMETHODIMP SetClientSite(LPOLECLIENTSITE);
  536. STDMETHODIMP GetClientSite(LPOLECLIENTSITE *);
  537. STDMETHODIMP SetHostNames(LPCOLESTR, LPCOLESTR);
  538. STDMETHODIMP Close(DWORD);
  539. STDMETHODIMP SetMoniker(DWORD, LPMONIKER);
  540. STDMETHODIMP GetMoniker(DWORD, DWORD, LPMONIKER *);
  541. STDMETHODIMP InitFromData(LPDATAOBJECT, BOOL, DWORD);
  542. STDMETHODIMP GetClipboardData(DWORD, LPDATAOBJECT *);
  543. STDMETHODIMP DoVerb(LONG, LPMSG, LPOLECLIENTSITE, LONG
  544. , HWND, LPCRECT);
  545. STDMETHODIMP EnumVerbs(LPENUMOLEVERB *);
  546. STDMETHODIMP Update(void);
  547. STDMETHODIMP IsUpToDate(void);
  548. STDMETHODIMP GetUserClassID(CLSID *);
  549. STDMETHODIMP GetUserType(DWORD, LPOLESTR *);
  550. STDMETHODIMP SetExtent(DWORD, LPSIZEL);
  551. STDMETHODIMP GetExtent(DWORD, LPSIZEL);
  552. STDMETHODIMP Advise(LPADVISESINK, DWORD *);
  553. STDMETHODIMP Unadvise(DWORD);
  554. STDMETHODIMP EnumAdvise(LPENUMSTATDATA *);
  555. STDMETHODIMP GetMiscStatus(DWORD, DWORD *);
  556. STDMETHODIMP SetColorScheme(LPLOGPALETTE);
  557. };
  558. //IVIEWOBJ.CPP
  559. class CImpIViewObject : public IViewObject2
  560. {
  561. private:
  562. ULONG m_cRef;
  563. PCPolyline m_pObj;
  564. LPUNKNOWN m_pUnkOuter;
  565. public:
  566. CImpIViewObject(PCPolyline, LPUNKNOWN);
  567. virtual ~CImpIViewObject(void);
  568. //IUnknown members that delegate to m_pUnkOuter.
  569. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  570. STDMETHODIMP_(ULONG) AddRef(void);
  571. STDMETHODIMP_(ULONG) Release(void);
  572. //IViewObject members
  573. STDMETHODIMP Draw(
  574. DWORD,
  575. LONG,
  576. LPVOID,
  577. DVTARGETDEVICE *,
  578. HDC,
  579. HDC,
  580. LPCRECTL,
  581. LPCRECTL,
  582. BOOL (CALLBACK *)(DWORD_PTR),
  583. DWORD_PTR );
  584. STDMETHODIMP GetColorSet(DWORD, LONG, LPVOID
  585. , DVTARGETDEVICE *, HDC, LPLOGPALETTE *);
  586. STDMETHODIMP Freeze(DWORD, LONG, LPVOID, LPDWORD);
  587. STDMETHODIMP Unfreeze(DWORD);
  588. STDMETHODIMP SetAdvise(DWORD, DWORD, LPADVISESINK);
  589. STDMETHODIMP GetAdvise(LPDWORD, LPDWORD, LPADVISESINK *);
  590. STDMETHODIMP GetExtent(DWORD, LONG, DVTARGETDEVICE *, LPSIZEL);
  591. };
  592. class CImpIRunnableObject : public IRunnableObject
  593. {
  594. protected:
  595. ULONG m_cRef;
  596. PCPolyline m_pObj;
  597. LPUNKNOWN m_pUnkOuter;
  598. public:
  599. CImpIRunnableObject(PCPolyline, LPUNKNOWN);
  600. virtual ~CImpIRunnableObject(void);
  601. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  602. STDMETHODIMP_(ULONG) AddRef(void);
  603. STDMETHODIMP_(ULONG) Release(void);
  604. STDMETHODIMP GetRunningClass(LPCLSID);
  605. STDMETHODIMP Run(LPBINDCTX);
  606. STDMETHODIMP_(BOOL) IsRunning(void);
  607. STDMETHODIMP LockRunning(BOOL, BOOL);
  608. STDMETHODIMP SetContainedObject(BOOL);
  609. };
  610. class CImpIExternalConnection : public IExternalConnection
  611. {
  612. protected:
  613. ULONG m_cRef;
  614. PCPolyline m_pObj;
  615. LPUNKNOWN m_pUnkOuter;
  616. DWORD m_cLockStrong;
  617. public:
  618. CImpIExternalConnection(PCPolyline, LPUNKNOWN);
  619. virtual ~CImpIExternalConnection(void);
  620. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  621. STDMETHODIMP_(ULONG) AddRef(void);
  622. STDMETHODIMP_(ULONG) Release(void);
  623. STDMETHODIMP_(DWORD) AddConnection(DWORD, DWORD);
  624. STDMETHODIMP_(DWORD) ReleaseConnection(DWORD, DWORD, BOOL);
  625. };
  626. class CImpIOleInPlaceObject : public IOleInPlaceObject
  627. {
  628. protected:
  629. ULONG m_cRef;
  630. PCPolyline m_pObj;
  631. LPUNKNOWN m_pUnkOuter;
  632. public:
  633. CImpIOleInPlaceObject(PCPolyline, LPUNKNOWN);
  634. virtual ~CImpIOleInPlaceObject(void);
  635. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  636. STDMETHODIMP_(ULONG) AddRef(void);
  637. STDMETHODIMP_(ULONG) Release(void);
  638. STDMETHODIMP GetWindow(HWND *);
  639. STDMETHODIMP ContextSensitiveHelp(BOOL);
  640. STDMETHODIMP InPlaceDeactivate(void);
  641. STDMETHODIMP UIDeactivate(void);
  642. STDMETHODIMP SetObjectRects(LPCRECT, LPCRECT);
  643. STDMETHODIMP ReactivateAndUndo(void);
  644. };
  645. class CImpIOleInPlaceActiveObject
  646. : public IOleInPlaceActiveObject
  647. {
  648. protected:
  649. ULONG m_cRef;
  650. PCPolyline m_pObj;
  651. LPUNKNOWN m_pUnkOuter;
  652. public:
  653. CImpIOleInPlaceActiveObject(PCPolyline, LPUNKNOWN);
  654. virtual ~CImpIOleInPlaceActiveObject(void);
  655. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  656. STDMETHODIMP_(ULONG) AddRef(void);
  657. STDMETHODIMP_(ULONG) Release(void);
  658. STDMETHODIMP GetWindow(HWND *);
  659. STDMETHODIMP ContextSensitiveHelp(BOOL);
  660. STDMETHODIMP TranslateAccelerator(LPMSG);
  661. STDMETHODIMP OnFrameWindowActivate(BOOL);
  662. STDMETHODIMP OnDocWindowActivate(BOOL);
  663. STDMETHODIMP ResizeBorder(LPCRECT, LPOLEINPLACEUIWINDOW
  664. , BOOL);
  665. STDMETHODIMP EnableModeless(BOOL);
  666. };
  667. class CImpISpecifyPP : public ISpecifyPropertyPages
  668. {
  669. protected:
  670. ULONG m_cRef; //Interface reference count
  671. PCPolyline m_pObj; //Backpointer to the object
  672. LPUNKNOWN m_pUnkOuter; //For delegation
  673. public:
  674. CImpISpecifyPP(PCPolyline, LPUNKNOWN);
  675. virtual ~CImpISpecifyPP(void);
  676. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  677. STDMETHODIMP_(ULONG) AddRef(void);
  678. STDMETHODIMP_(ULONG) Release(void);
  679. STDMETHODIMP GetPages(CAUUID *);
  680. };
  681. class CImpIProvideClassInfo : public IProvideClassInfo
  682. {
  683. protected:
  684. ULONG m_cRef; //Interface reference count
  685. PCPolyline m_pObj; //Backpointer to the object
  686. LPUNKNOWN m_pUnkOuter; //For delegation
  687. public:
  688. CImpIProvideClassInfo(PCPolyline, LPUNKNOWN);
  689. virtual ~CImpIProvideClassInfo(void);
  690. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  691. STDMETHODIMP_(ULONG) AddRef(void);
  692. STDMETHODIMP_(ULONG) Release(void);
  693. STDMETHODIMP GetClassInfo(LPTYPEINFO *);
  694. };
  695. class CImpIDispatch : public IDispatch
  696. {
  697. public:
  698. private:
  699. ULONG m_cRef; //For debugging
  700. LPUNKNOWN m_pObj;
  701. LPUNKNOWN m_pUnkOuter;
  702. LPUNKNOWN m_pInterface;
  703. IID m_DIID;
  704. ITypeInfo *m_pITI; //Type information
  705. public:
  706. CImpIDispatch(LPUNKNOWN, LPUNKNOWN);
  707. virtual ~CImpIDispatch(void);
  708. void SetInterface(REFIID, LPUNKNOWN);
  709. //IUnknown members that delegate to m_pUnkOuter.
  710. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  711. STDMETHODIMP_(ULONG) AddRef(void);
  712. STDMETHODIMP_(ULONG) Release(void);
  713. //IDispatch members
  714. STDMETHODIMP GetTypeInfoCount(UINT *);
  715. STDMETHODIMP GetTypeInfo(UINT, LCID, ITypeInfo **);
  716. STDMETHODIMP GetIDsOfNames(REFIID, OLECHAR **, UINT, LCID
  717. , DISPID *);
  718. STDMETHODIMP Invoke(DISPID, REFIID, LCID, WORD
  719. , DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *);
  720. };
  721. class CImpISystemMonitor : public ISystemMonitor
  722. {
  723. protected:
  724. ULONG m_cRef; //Interface reference count
  725. PCPolyline m_pObj; //Back pointer to object
  726. LPUNKNOWN m_pUnkOuter; //Controlling unknown
  727. public:
  728. CImpISystemMonitor(PCPolyline, LPUNKNOWN);
  729. virtual ~CImpISystemMonitor(void);
  730. //IUnknown members.
  731. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  732. STDMETHODIMP_(ULONG) AddRef(void);
  733. STDMETHODIMP_(ULONG) Release(void);
  734. //Manipulation members:
  735. STDMETHODIMP put_Appearance(INT);
  736. STDMETHODIMP get_Appearance(INT*);
  737. STDMETHODIMP put_BackColor(OLE_COLOR);
  738. STDMETHODIMP get_BackColor(OLE_COLOR*);
  739. STDMETHODIMP put_BorderStyle(INT);
  740. STDMETHODIMP get_BorderStyle(INT*);
  741. STDMETHODIMP put_ForeColor(OLE_COLOR);
  742. STDMETHODIMP get_ForeColor(OLE_COLOR*);
  743. STDMETHODIMP put_BackColorCtl(OLE_COLOR);
  744. STDMETHODIMP get_BackColorCtl(OLE_COLOR*);
  745. STDMETHODIMP put_GridColor(OLE_COLOR);
  746. STDMETHODIMP get_GridColor(OLE_COLOR*);
  747. STDMETHODIMP put_TimeBarColor(OLE_COLOR);
  748. STDMETHODIMP get_TimeBarColor(OLE_COLOR*);
  749. STDMETHODIMP putref_Font(IFontDisp *pFont);
  750. STDMETHODIMP get_Font(IFontDisp **ppFont);
  751. STDMETHODIMP put_ShowVerticalGrid(VARIANT_BOOL);
  752. STDMETHODIMP get_ShowVerticalGrid(VARIANT_BOOL*);
  753. STDMETHODIMP put_ShowHorizontalGrid(VARIANT_BOOL);
  754. STDMETHODIMP get_ShowHorizontalGrid(VARIANT_BOOL*);
  755. STDMETHODIMP put_ShowLegend(VARIANT_BOOL);
  756. STDMETHODIMP get_ShowLegend(VARIANT_BOOL*);
  757. STDMETHODIMP put_ShowToolbar(VARIANT_BOOL);
  758. STDMETHODIMP get_ShowToolbar(VARIANT_BOOL*);
  759. STDMETHODIMP put_ShowValueBar(VARIANT_BOOL);
  760. STDMETHODIMP get_ShowValueBar(VARIANT_BOOL*);
  761. STDMETHODIMP put_ShowScaleLabels(VARIANT_BOOL);
  762. STDMETHODIMP get_ShowScaleLabels(VARIANT_BOOL*);
  763. STDMETHODIMP put_MaximumScale(INT);
  764. STDMETHODIMP get_MaximumScale(INT*);
  765. STDMETHODIMP put_MinimumScale(INT);
  766. STDMETHODIMP get_MinimumScale(INT*);
  767. STDMETHODIMP put_UpdateInterval(FLOAT);
  768. STDMETHODIMP get_UpdateInterval(FLOAT*);
  769. STDMETHODIMP put_DisplayFilter(INT);
  770. STDMETHODIMP get_DisplayFilter(INT*);
  771. STDMETHODIMP put_DisplayType(DisplayTypeConstants);
  772. STDMETHODIMP get_DisplayType(DisplayTypeConstants*);
  773. STDMETHODIMP put_ManualUpdate(VARIANT_BOOL);
  774. STDMETHODIMP get_ManualUpdate(VARIANT_BOOL*);
  775. STDMETHODIMP put_YAxisLabel(BSTR);
  776. STDMETHODIMP get_YAxisLabel(BSTR*);
  777. STDMETHODIMP put_GraphTitle(BSTR);
  778. STDMETHODIMP get_GraphTitle(BSTR*);
  779. STDMETHODIMP put_SqlDsnName(BSTR);
  780. STDMETHODIMP get_SqlDsnName(BSTR*);
  781. STDMETHODIMP put_SqlLogSetName(BSTR);
  782. STDMETHODIMP get_SqlLogSetName(BSTR*);
  783. STDMETHODIMP put_LogFileName(BSTR);
  784. STDMETHODIMP get_LogFileName(BSTR*);
  785. STDMETHODIMP get_LogFiles(ILogFiles**);
  786. STDMETHODIMP put_DataSourceType(DataSourceTypeConstants);
  787. STDMETHODIMP get_DataSourceType(DataSourceTypeConstants*);
  788. STDMETHODIMP put_LogViewStart(DATE);
  789. STDMETHODIMP get_LogViewStart(DATE*);
  790. STDMETHODIMP put_LogViewStop(DATE);
  791. STDMETHODIMP get_LogViewStop(DATE*);
  792. STDMETHODIMP put_Highlight(VARIANT_BOOL);
  793. STDMETHODIMP get_Highlight(VARIANT_BOOL*);
  794. STDMETHODIMP put_ReadOnly(VARIANT_BOOL);
  795. STDMETHODIMP get_ReadOnly(VARIANT_BOOL*);
  796. STDMETHODIMP put_ReportValueType(ReportValueTypeConstants);
  797. STDMETHODIMP get_ReportValueType(ReportValueTypeConstants*);
  798. STDMETHODIMP put_MonitorDuplicateInstances(VARIANT_BOOL);
  799. STDMETHODIMP get_MonitorDuplicateInstances(VARIANT_BOOL*);
  800. STDMETHODIMP get_Counters(ICounters**);
  801. STDMETHODIMP CollectSample(void);
  802. STDMETHODIMP BrowseCounters(void);
  803. STDMETHODIMP DisplayProperties(void);
  804. STDMETHODIMP Counter(INT iIndex, ICounterItem**);
  805. STDMETHODIMP AddCounter(BSTR bsPath, ICounterItem**);
  806. STDMETHODIMP DeleteCounter(ICounterItem *pItem);
  807. STDMETHODIMP LogFile ( INT iIndex, ILogFileItem** );
  808. STDMETHODIMP AddLogFile ( BSTR bsPath, ILogFileItem** );
  809. STDMETHODIMP DeleteLogFile ( ILogFileItem *pItem );
  810. STDMETHODIMP UpdateGraph(void);
  811. STDMETHODIMP Paste(void);
  812. STDMETHODIMP Copy(void);
  813. STDMETHODIMP Reset(void);
  814. // methods not exposed by ISystemMonitor
  815. HRESULT SetLogFileRange(LONGLONG llBegin, LONGLONG LLEnd);
  816. HRESULT GetLogFileRange(LONGLONG *pllBegin, LONGLONG *pLLEnd);
  817. HRESULT SetLogViewTempRange(LONGLONG llStart, LONGLONG llStop);
  818. HRESULT GetVisuals(
  819. OLE_COLOR *prgbColor,
  820. INT *piColorIndex,
  821. INT *piWidthIndex,
  822. INT *piStyleIndex);
  823. HRESULT SetVisuals(
  824. OLE_COLOR rgbColor,
  825. INT iColorIndex,
  826. INT iWidthIndex,
  827. INT iStyleIndex);
  828. STDMETHODIMP GetSelectedCounter(ICounterItem**);
  829. HLOG GetDataSourceHandle ( void );
  830. };
  831. class CImpIOleControl : public IOleControl
  832. {
  833. protected:
  834. ULONG m_cRef; //Interface reference count
  835. PCPolyline m_pObj; //Backpointer to the object
  836. LPUNKNOWN m_pUnkOuter; //For delegation
  837. public:
  838. CImpIOleControl(PCPolyline, LPUNKNOWN);
  839. virtual ~CImpIOleControl(void);
  840. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  841. STDMETHODIMP_(ULONG) AddRef(void);
  842. STDMETHODIMP_(ULONG) Release(void);
  843. STDMETHODIMP GetControlInfo(LPCONTROLINFO);
  844. STDMETHODIMP OnMnemonic(LPMSG);
  845. STDMETHODIMP OnAmbientPropertyChange(DISPID);
  846. STDMETHODIMP FreezeEvents(BOOL);
  847. };
  848. /*****************************************
  849. class CAdviseRouter : public ISystemMonitorEvents
  850. {
  851. private:
  852. ULONG m_cRef;
  853. PCPolyline m_pObj;
  854. IDispatch *m_pIDispatch;
  855. public:
  856. CAdviseRouter(IDispatch *, PCPolyline);
  857. virtual ~CAdviseRouter(void);
  858. void Invoke(DISPID dispId, INT iParam);
  859. //IUnknown members
  860. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  861. STDMETHODIMP_(ULONG) AddRef(void);
  862. STDMETHODIMP_(ULONG) Release(void);
  863. //Advise members.
  864. STDMETHODIMP_(void) OnCounterSelected(INT iIndex);
  865. STDMETHODIMP_(void) OnCounterAdded(INT iIndex);
  866. STDMETHODIMP_(void) OnCounterDeleted(INT iIndex);
  867. };
  868. //These values match the ID's in smonctrl.odl
  869. enum
  870. {
  871. EVENT_ONCOUNTERSELECTED=1,
  872. EVENT_ONCOUNTERADDED=2,
  873. EVENT_ONCOUNTERDELETED=3,
  874. };
  875. ***************************************/
  876. #endif //_POLYLINE_H_