home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / mmc / mmcInterfaces.cs < prev    next >
Encoding:
Text File  |  2000-06-23  |  12.3 KB  |  274 lines

  1. //-------------------------------------------------------------
  2. // mmcInterfaces.cs
  3. //
  4. // Contains definitions for various interfaces used by a MMC snapin
  5. //
  6. // NOTE: This is not an all-encompasing list of every interface
  7. // available to a snapin
  8. //-------------------------------------------------------------
  9.  
  10. using System;
  11. using System.Runtime.InteropServices;
  12.  
  13. namespace Microsoft.SampleMMC
  14. {
  15.  
  16. //-------------------------------------------------------------
  17. // Note on all interfaces:
  18. //
  19. // Though C# and NGWS intend to use namespaces to replace GUIDs, 
  20. // they must still be used here with every interface. This is 
  21. // necessary because, when creating a MMC snapin,  we are dealing 
  22. // with a classic COM server and client; hence, we must use the
  23. // GUIDs so the classic COM portion of MMC does not get 
  24. // confused.
  25. //-------------------------------------------------------------
  26.  
  27. //------------------------------------------\\
  28. // Interfaces that need to be implemented   \\ 
  29. //------------------------------------------\\
  30.  
  31. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("955AB28A-5218-11D0-A985-00C04FD8D565")]
  32. public interface IComponentData
  33. {
  34.     void Initialize([MarshalAs(UnmanagedType.Interface)] Object pUnknown);
  35.     void CreateComponent(out IComponent ppComponent);
  36.     void Notify(IDataObject lpDataObject, uint aevent, int arg, int param);
  37.     void Destroy();
  38.     void QueryDataObject(int cookie, uint type, out IDataObject ppDataObject);
  39.     void GetDisplayInfo(ref SCOPEDATAITEM ResultDataItem);
  40.     void CompareObjects(IDataObject lpDataObjectA, IDataObject lpDataObjectB);
  41. }// interface IComponentData
  42.  
  43. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("43136EB2-D36C-11CF-ADBC-00AA00A80033")]
  44. public interface IComponent
  45. {
  46.     void Initialize([MarshalAs(UnmanagedType.Interface)]Object lpConsole);
  47.     void Notify(IDataObject lpDataObject, uint aevent, int arg, int param);
  48.     void Destroy(int cookie);
  49.     void QueryDataObject(int cookie, uint type, out IDataObject ppDataObject);
  50.     void GetResultViewType(int cookie, out int ppViewType, out int pViewOptions);
  51.     void GetDisplayInfo(ref RESULTDATAITEM ResultDataItem);
  52.     void CompareObjects(IDataObject lpDataObjectA, IDataObject lpDataObjectB);
  53. }// interface IComponent
  54.  
  55. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("1245208C-A151-11D0-A7D7-00C04FD909DD")]
  56. public interface ISnapinAbout
  57. {
  58.     void GetSnapinDescription(out int lpDescription);
  59.     void GetProvider(out int pName);
  60.     void GetSnapinVersion(out int lpVersion);
  61.     void GetSnapinImage(out int hAppIcon);
  62.     void GetStaticFolderImage(out int hSmallImage, out int hSmallImageOpen, out int hLargeImage, out int cMask);
  63. }// interface ISnapinAbout
  64.  
  65. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000010e-0000-0000-C000-000000000046")]
  66. public interface IDataObject
  67. {
  68.     void GetData(ref FORMATETC a, ref STGMEDIUM b);
  69.     void GetDataHere(ref FORMATETC a, ref STGMEDIUM b);
  70.     void QueryGetData(ref FORMATETC a);
  71.     void GetCanonicalFormatEtc(ref FORMATETC a, out FORMATETC b);
  72.     void SetData(ref FORMATETC a, ref userFLAG_STGMEDIUM b, int c);
  73.     void EnumFormatEtc(uint a, out Object b);
  74.     void DAdvise(ref FORMATETC a, uint b, ref Object c, out uint d);
  75.     void DUnadvise(uint a);
  76.     void EnumDAdvise(out Object a);
  77. }// interface IDataObject
  78.  
  79. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("4861A010-20F9-11d2-A510-00C04FB6DD2C")]
  80. public interface ISnapinHelp2
  81. {
  82.     void GetHelpTopic(out int lpCompiledHelpFile);
  83.     void GetLinkedTopics(out int lpCompiledHelpFiles);
  84. }// ISnapinHelp2
  85.  
  86.  
  87. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("cc593830-b926-11d1-8063-0000f875a9ce")]
  88. public interface IDisplayHelp
  89. {
  90.     void ShowTopic([MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] String pszHelpTopic);
  91. }// IDisplayHelp
  92.  
  93.  
  94. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("4F3B7A4F-CFAC-11CF-B8E3-00C04FD8D5B0")]
  95. public interface IExtendContextMenu
  96. {
  97.     void AddMenuItems(IDataObject piDataObject, IContextMenuCallback piCallback, ref int pInsertionAllowed);
  98.     void Command(int lCommandID, IDataObject piDataObject);
  99. }// IExtendContextMenu
  100.  
  101. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("49506520-6F40-11D0-A98B-00C04FD8D565")]
  102. public interface IExtendControlbar
  103. {
  104.     void SetControlbar(IControlbar pControlbar);
  105.     void ControlbarNotify(uint aevent, int arg, int param);
  106. }// IExtendControlbar
  107.  
  108.  
  109. //------------------------------------------\\
  110. // Interfaces implemented by MMC            \\ 
  111. // (No need to implement them... yeah!)     \\
  112. //------------------------------------------\\
  113. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("85DE64DE-EF21-11cf-A285-00C04FD8DBE6")]
  114. public interface IPropertySheetProvider
  115. {
  116.     void CreatePropertySheet([MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] String title, int type, int cookie, IDataObject pIDataObjectm, uint dwOptions);
  117.     void FindPropertySheet(int cookie, IComponent lpComponent, IDataObject lpDataObject);
  118.     void AddPrimaryPages([MarshalAs(UnmanagedType.Interface)]Object lpUnknown, int bCreateHandle, int hNotifyWindow,int bScopePane);
  119.     void AddExtensionPages();
  120.     void Show(int window, int page);
  121. }// IPropertySheetProvider       
  122.  
  123. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("85DE64DD-EF21-11cf-A285-00C04FD8DBE6")]
  124. public interface IPropertySheetCallback
  125. {
  126.     void AddPage(int hPage);
  127.     void RemovePage(int hPage);
  128. }// IPropertySheetCallback
  129.  
  130. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("85DE64DC-EF21-11cf-A285-00C04FD8DBE6")]
  131. public interface IExtendPropertySheet
  132. {
  133.     void CreatePropertyPages(IPropertySheetCallback lpProvider, int handle, IDataObject lpIDataObject);
  134.     void QueryPagesFor(IDataObject lpDataObject);
  135. }// IExtendPropertySheet
  136.  
  137.    
  138. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("255F18CC-65DB-11D1-A7DC-00C04FD8D565")]
  139. public interface IConsoleNameSpace2
  140. {
  141.     void InsertItem(ref SCOPEDATAITEM a);
  142.     void DeleteItem(uint a, int b);
  143.     void SetItem(ref SCOPEDATAITEM a);
  144.     void GetItem(ref SCOPEDATAITEM a);
  145.     void GetChildItem(uint a, ref uint b, ref int c);
  146.     void GetNextItem(uint a, ref uint b, ref int c);
  147.     void GetParentItem(uint a, ref uint b, ref int c);
  148.     void Expand(uint a);
  149.     void AddExtension(CLSID a, ref SCOPEDATAITEM b); 
  150. }// IConsoleNameSpace2
  151.  
  152.   
  153. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("43136EB3-D36C-11CF-ADBC-00AA00A80033")]
  154. public interface IHeaderCtrl
  155. {
  156.     void InsertColumn(int nCol, [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] String title,int nFormat,int nWidth);
  157.     void DeleteColumn(int nCol);
  158.     void SetColumnText(int nCol, [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] String title);
  159.     void GetColumnText(int nCol,out int pText);
  160.     void SetColumnWidth(int nCol, int nWidth);
  161.     void GetColumnWidth(int nCol, out int pWidth);
  162.  }// IHeaderCtrl
  163.  
  164. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("31DA5FA0-E0EB-11cf-9F21-00AA003CA9F6")]
  165. public interface IResultData 
  166. {
  167.     void InsertItem(ref RESULTDATAITEM item);
  168.     void DeleteItem(uint itemID, int nCol);
  169.     void FindItemByLParam(int lParam, out uint pItemID);
  170.     void DeleteAllRsltItems();
  171.     void SetItem(ref RESULTDATAITEM item);
  172.     void GetItem(ref RESULTDATAITEM item);
  173.     void GetNextItem(ref RESULTDATAITEM item);
  174.     void ModifyItemState(int nIndex, uint itemID, uint uAdd, uint uRemove);
  175.     void ModifyViewStyle(int add, int remove);
  176.     void SetViewMode(int lViewMode);
  177.     void GetViewMode(out int lViewMode);
  178.     void UpdateItem(uint itemID);
  179.     void Sort(int nColumn, uint dwSortOptions, int lUserParam);
  180.     void SetDescBarText([MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] ref String DescText);
  181.     void SetItemCount(int nItemCount, uint dwOptions);
  182. }// IResultData
  183.  
  184. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("43136EB8-D36C-11CF-ADBC-00AA00A80033")]
  185. public interface IImageList
  186. {
  187.     void ImageListSetIcon(int pIcon, int nLoc);
  188.     void ImageListSetStrip(int pBMapSm, int pBMapLg, int nStartLoc, int cMask);
  189. }// IImageList
  190.  
  191. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("103D842A-AA63-11D1-A7E1-00C04FD8D565")]
  192. public interface IConsole2
  193. {
  194.     void SetHeader(ref IHeaderCtrl pHeader);
  195.     void SetToolbar([MarshalAs(UnmanagedType.Interface)] ref Object pToolbar); // Needs to be LPTOOLBAR 
  196.     void QueryResultView([MarshalAs(UnmanagedType.Interface)] out Object pUnknown);
  197.     void QueryScopeImageList(out IImageList ppImageList);
  198.     void QueryResultImageList(out IImageList ppImageList);
  199.     void UpdateAllViews(IDataObject lpDataObject, int data, int hint);
  200.     void MessageBox([MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] String lpszText, [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] String lpszTitle, uint fuStyle, ref int piRetval);
  201.     void QueryConsoleVerb(out IConsoleVerb ppConsoleVerb);
  202.     void SelectScopeItem(int hScopeItem);
  203.     void GetMainWindow(ref int phwnd);
  204.     void NewWindow(int hScopeItem, uint lOptions);
  205.     void Expand(int hItem, int bExpand);
  206.     void IsTaskpadViewPreferred();
  207.     void SetStatusText([MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]String pszStatusText);
  208. }// IConsole2
  209.  
  210. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("43136EB7-D36C-11CF-ADBC-00AA00A80033")]
  211. public interface IContextMenuCallback
  212. {
  213.     void AddItem(ref CONTEXTMENUITEM pItem);
  214. }// IContextMenuCallback
  215.  
  216. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("69FB811E-6C1C-11D0-A2CB-00C04FD909DD")]
  217. public interface IControlbar
  218. {
  219.     void Create(MMC_CONTROL_TYPE nType, IExtendControlbar pExtendControlbar, [MarshalAs(UnmanagedType.Interface)] out Object ppUnknown);
  220.     void Attach(MMC_CONTROL_TYPE nType, [MarshalAs(UnmanagedType.Interface)] Object lpUnknown);
  221.     void Detach([MarshalAs(UnmanagedType.Interface)] Object lpUnknown);
  222. }// IControlbar
  223.  
  224. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("43136EB9-D36C-11CF-ADBC-00AA00A80033")]
  225. public interface IToolbar
  226. {
  227.     void AddBitmap(int nImages, int hbmp, int cxSize, int cySize, int crMask);
  228.     void AddButtons(int nButtons, ref MMCBUTTON lpButtons);
  229.     void InsertButton(int nIndex, ref MMCBUTTON lpButton);
  230.     void DeleteButton(int nIndex);
  231.     void GetButtonState(int idCommand, MMC_BUTTON_STATE nState, out int pState);
  232.     void SetButtonState(int idCommand, MMC_BUTTON_STATE nState, int bState);
  233. }// IToolbar   
  234.  
  235. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("E49F7A60-74AF-11D0-A286-00C04FD8FE93")]
  236. public interface IConsoleVerb 
  237. {
  238.     void GetVerbState(uint eCmdID, uint nState, ref int pState);
  239.     void SetVerbState(uint eCmdID, uint nState, int bState);
  240.     void SetDefaultVerb(uint eCmdID);
  241.     void GetDefaultVerb(ref uint peCmdID);
  242. }// IConsoleVerb
  243.  
  244. //--------------------------------------------------------------------
  245. // The following interfaces are not MMC specific interfaces and do not 
  246. // need to be implemented, but their details must be known by the snapin;
  247. // thus, we're defining them here. I don't make any guarantees that the
  248. // interfaces are 100% accurate.... I could be missing "ref" or have extra
  249. // "ref" parameters in these. I only know for certain that Write works.
  250. //--------------------------------------------------------------------
  251.  
  252. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0c733a30-2a1c-11ce-ade5-00aa0044773d")]
  253. public interface ISequentialStream 
  254. {
  255.     void Read(int pv, uint cb, out uint pcbRead);
  256.     void Write(int pv, uint cb, out uint pcbWritten);
  257. }// ISequentialStream
  258.  
  259. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000000c-0000-0000-C000-000000000046")]
  260. public interface IStream : ISequentialStream
  261. {
  262.     void Seek(long dlibMove, uint dwOrigin, out ulong plibNewPosition);
  263.     void SetSize(ulong libNewSize);
  264.     void CopyTo(IStream pstm, ulong cb, out ulong pcbRead, out ulong pcbWritten);
  265.     void Commit(uint grfCommitFlags);
  266.     void Revert();
  267.     void LockRegion(ulong libOffset, ulong cb, uint dwLockType);
  268.     void UnlockRegion(ulong libOffset, ulong cb, uint dwLockType);
  269.     void Stat(out STATSTG pstatstg, uint grfStatFlag);
  270.     void Clone(out IStream ppstm);
  271.  }// IStream
  272.  
  273. }// namespace Microsoft.SampleMMC
  274.