Source code of Windows XP (NT5)
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.

75 lines
2.0 KiB

  1. /*--------------------------------------------------------------------------*
  2. *
  3. * Microsoft Windows
  4. * Copyright (C) Microsoft Corporation, 1992 - 000
  5. *
  6. * File: viewexttest.cpp
  7. *
  8. * Contents: Implementation file for view extension test snap-ins
  9. *
  10. * History: 20-Mar-2000 jeffro Created
  11. *
  12. *--------------------------------------------------------------------------*/
  13. #include "stdafx.hxx"
  14. #include "ViewExtTest.h"
  15. // {49737049-EBF3-4e1c-B034-DE4936EDD1F4}
  16. const CLSID CLSID_EventViewExtension1 =
  17. { 0x49737049, 0xebf3, 0x4e1c, { 0xb0, 0x34, 0xde, 0x49, 0x36, 0xed, 0xd1, 0xf4 } };
  18. // {94AED30D-A033-436c-9919-E09CBA339973}
  19. const CLSID CLSID_EventViewExtension2 =
  20. { 0x94aed30d, 0xa033, 0x436c, { 0x99, 0x19, 0xe0, 0x9c, 0xba, 0x33, 0x99, 0x73 } };
  21. /*+-------------------------------------------------------------------------*
  22. * CEventViewExtension1::GetViews
  23. *
  24. *
  25. *--------------------------------------------------------------------------*/
  26. STDMETHODIMP CViewExtension::GetViews (
  27. IDataObject* pDataObject,
  28. IViewExtensionCallback* pViewExtCallback)
  29. {
  30. DECLARE_SC (sc, _T("CEventViewExtension1::GetView"));
  31. sc = ScCheckPointers (pViewExtCallback);
  32. if (sc)
  33. return (sc.ToHr());
  34. /*
  35. * generate a URL for the view extension using the res: protocol and
  36. * duplicate it into a CoTaskMemAlloc'd buffer
  37. */
  38. TCHAR szModule[_MAX_PATH];
  39. GetModuleFileName (_Module.GetModuleInstance(), szModule, countof(szModule));
  40. std::wstring strURL;
  41. UINT nResourceID = GetResourceID();
  42. if (nResourceID != 0)
  43. {
  44. WCHAR szResourceID[6];
  45. _itow (nResourceID, szResourceID, 10);
  46. USES_CONVERSION;
  47. strURL = std::wstring(L"res://") + T2W(szModule) + L"/" + szResourceID;
  48. }
  49. else
  50. strURL = GetResource();
  51. std::wstring strTabName (GetTabName());
  52. std::wstring strTooltip (GetTooltip());
  53. MMC_EXT_VIEW_DATA xvd;
  54. xvd.viewID = GetCLSID();
  55. xvd.pszURL = strURL.data();
  56. xvd.pszViewTitle = strTabName.data();
  57. xvd.pszTooltipText = strTooltip.data();
  58. xvd.bReplacesDefaultView = TRUE;
  59. return (pViewExtCallback->AddView (&xvd));
  60. }