home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / mmc.idl < prev    next >
Text File  |  1998-04-25  |  53KB  |  1,416 lines

  1. import "oaidl.idl";
  2.  
  3.  
  4. ///////////////////////////////////////////////////////////////////////////////
  5. /// Interfaces implement by the Common Console's Node Manager
  6.  
  7. interface IConsole;
  8. interface IHeaderCtrl;
  9. interface IToolbar;
  10. interface IImageList;
  11. interface IResultData;
  12. interface IConsoleNameSpace;
  13. interface IPropertySheetProvider;
  14. interface IPropertySheetCallback;
  15. interface IContextMenuProvider;
  16. interface IContextMenuCallback;
  17. interface IControlbar;
  18. interface IConsoleVerb;
  19. interface IMenuButton;
  20. interface IQuickFilter;
  21.  
  22.  
  23. ///////////////////////////////////////////////////////////////////////////////
  24. /// Interfaces implement by the Snap-in server
  25.  
  26. interface IComponent;
  27. interface IComponentData;
  28. interface IExtendPropertySheet;
  29. interface IExtendContextMenu;
  30. interface IExtendControlbar;
  31. interface IResultDataCompare;
  32. interface ISnapinAbout;
  33. interface IResultOwnerData;
  34.  
  35. ///////////////////////////////////////////////////////////////////////////////
  36. /// Type definitions
  37.  
  38. typedef IConsole*                   LPCONSOLE;
  39. typedef IHeaderCtrl*                LPHEADERCTRL;
  40. typedef IToolbar*                   LPTOOLBAR;
  41. typedef IImageList*                 LPIMAGELIST;
  42. typedef IResultData*                LPRESULTDATA;
  43. typedef IConsoleNameSpace*          LPCONSOLENAMESPACE;
  44. typedef IPropertySheetProvider*     LPPROPERTYSHEETPROVIDER;
  45. typedef IPropertySheetCallback*     LPPROPERTYSHEETCALLBACK;
  46. typedef IContextMenuProvider*       LPCONTEXTMENUPROVIDER;
  47. typedef IContextMenuCallback*       LPCONTEXTMENUCALLBACK;
  48. typedef IControlbar*                LPCONTROLBAR;
  49. typedef IConsoleVerb*               LPCONSOLEVERB;
  50. typedef IMenuButton*                LPMENUBUTTON;
  51. typedef IQuickFilter*               LPQUICKFILTER;
  52.  
  53. typedef IComponent*                 LPCOMPONENT;
  54. typedef IComponentData*             LPCOMPONENTDATA;
  55. typedef IExtendPropertySheet*       LPEXTENDPROPERTYSHEET;
  56. typedef IExtendContextMenu*         LPEXTENDCONTEXTMENU;
  57. typedef IExtendControlbar*          LPEXTENDCONTROLBAR;
  58. typedef IResultDataCompare*         LPRESULTDATACOMPARE;
  59. typedef ISnapinAbout*               LPSNAPABOUT;
  60. typedef IResultOwnerData*           LPRESULTOWNERDATA;
  61.  
  62. ///////////////////////////////////////////////////////////////////////////////
  63. // Published Common Console ListView constants
  64.  
  65. #define LVS_ICON                0x0000
  66. #define LVS_REPORT              0x0001
  67. #define LVS_SMALLICON           0x0002
  68. #define LVS_LIST                0x0003
  69. #define LVSICF_NOINVALIDATEALL  0x00000001
  70. #define LVSICF_NOSCROLL         0x00000002
  71.  
  72. const long  MMCLV_AUTO = -1;
  73. const long  MMCLV_NOPARAM = -2;
  74. const long  MMCLV_NOICON = -1;
  75. const long  MMCLV_VIEWSTYLE_ICON = LVS_ICON;
  76. const long  MMCLV_VIEWSTYLE_SMALLICON = LVS_SMALLICON;
  77. const long  MMCLV_VIEWSTYLE_LIST = LVS_LIST;
  78. const long  MMCLV_VIEWSTYLE_REPORT = LVS_REPORT;
  79. const long  MMCLV_VIEWSTYLE_FILTERED = 0x0004;
  80. const void* MMCLV_NOPTR = 0x0;
  81. const long  MMCLV_UPDATE_NOINVALIDATEALL = LVSICF_NOINVALIDATEALL;
  82. const long  MMCLV_UPDATE_NOSCROLL = LVSICF_NOSCROLL;
  83.  
  84. static unsigned short* MMC_CALLBACK = ((unsigned short *)(-1));
  85.  
  86. ///////////////////////////////////////////////////////////////////////////////
  87. // ResultData and Scope Data item structures.
  88.  
  89. typedef long    HSCOPEITEM;
  90. typedef long    COMPONENTID;
  91. typedef long    HRESULTITEM;
  92.  
  93. const DWORD RDI_STR     = 0x0002;
  94. const DWORD RDI_IMAGE   = 0x0004;
  95. const DWORD RDI_STATE   = 0x0008;
  96. const DWORD RDI_PARAM   = 0x0010;
  97. const DWORD RDI_INDEX   = 0x0020;
  98. const DWORD RDI_INDENT  = 0x0040;
  99.  
  100.  
  101. typedef enum _MMC_RESULT_VIEW_STYLE
  102. {
  103.     MMC_SINGLESEL       = 0x0001,
  104.     MMC_SHOWSELALWAYS   = 0x0002,
  105.     MMC_NOSORTHEADER    = 0x0004
  106.  
  107. } MMC_RESULT_VIEW_STYLE;
  108.  
  109.  
  110. // List view with single select
  111. const long MMC_VIEW_OPTIONS_NONE            = 0x0000;
  112.  
  113. // NO List view. Only custom views.
  114. const long MMC_VIEW_OPTIONS_NOLISTVIEWS     = 0x0001;
  115.  
  116. // List view with multi select.
  117. const long MMC_VIEW_OPTIONS_MULTISELECT     = 0x0002;
  118.  
  119. //List view with user owned data
  120. const long MMC_VIEW_OPTIONS_OWNERDATALIST   = 0x0004;
  121.  
  122. //List view with filtering allowed
  123. const long MMC_VIEW_OPTIONS_FILTERED        = 0x0008;
  124.  
  125. // Create new control (don't use cached)
  126. const long MMC_VIEW_OPTIONS_CREATENEW       = 0x0010;
  127.  
  128. // Property sheet options
  129. const DWORD MMC_PSO_NOAPPLYNOW              = 0x00000001;
  130. const DWORD MMC_PSO_HASHELP                 = 0x00000002;
  131. const DWORD MMC_PSO_NEWWIZARDTYPE           = 0x00000004;
  132.  
  133.  
  134.  
  135. // Type of controls that can be attached to the IControlbar
  136. typedef enum  _MMC_CONTROL_TYPE
  137. {
  138.     TOOLBAR,
  139.     MENUBUTTON,
  140.     COMBOBOXBAR
  141. } MMC_CONTROL_TYPE;
  142.  
  143.  
  144. ///////////////////////////////////////////////////////////////////////////////
  145. // Console commands - These should be reviewed
  146. //
  147. typedef enum _MMC_CONSOLE_VERB
  148. {
  149.     MMC_VERB_NONE            = 0x0000,
  150.     MMC_VERB_OPEN            = 0x8000,
  151.     MMC_VERB_COPY            = 0x8001, 
  152.     MMC_VERB_PASTE           = 0x8002, 
  153.     MMC_VERB_DELETE          = 0x8003, 
  154.     MMC_VERB_PROPERTIES      = 0x8004, 
  155.     MMC_VERB_RENAME          = 0x8005, 
  156.     MMC_VERB_REFRESH         = 0x8006,      
  157.     MMC_VERB_PRINT           = 0x8007, 
  158.     
  159. } MMC_CONSOLE_VERB;
  160.  
  161. // Structure to create buttons on the toolbar
  162. typedef struct _MMCButton
  163. {
  164.     int      nBitmap;       // Offset into the bitmap list 
  165.     int      idCommand;     // Command ID return when the button is clicked
  166.     BYTE     fsState;       // TBSTYLE_ENABLED ..etc
  167.     BYTE     fsType;        // TBSTYLE_BUTTON || TBSTYLE_SEP
  168.     LPOLESTR     lpButtonText;  // Text value for the Button
  169.     LPOLESTR     lpTooltipText; // Text value for the tooltip
  170.     
  171. } MMCBUTTON;
  172.  
  173. typedef MMCBUTTON* LPMMCBUTTON;
  174.  
  175. typedef enum _MMC_BUTTON_STATE
  176. {
  177.     ENABLED         = 0x01,
  178.     CHECKED         = 0x02,
  179.     HIDDEN          = 0x04,
  180.     INDETERMINATE   = 0x08,
  181.     BUTTONPRESSED   = 0x10,
  182.  
  183. } MMC_BUTTON_STATE;
  184.  
  185. typedef struct _RESULTDATAITEM
  186. {
  187.     DWORD       mask;
  188.     BOOL        bScopeItem;
  189.     HRESULTITEM itemID;
  190.     int         nIndex;
  191.     int         nCol;
  192.     LPOLESTR    str;
  193.     int         nImage;
  194.     UINT        nState;
  195.     LPARAM      lParam;
  196.     int         iIndent;
  197. } RESULTDATAITEM;
  198.  
  199. typedef RESULTDATAITEM* LPRESULTDATAITEM;
  200.  
  201. // Find result item options   
  202. const DWORD RFI_PARTIAL = 0x0001;
  203. const DWORD RFI_WRAP    = 0x0002;
  204.  
  205. typedef struct _RESULTFINDINFO
  206. {
  207.     LPOLESTR    psz;
  208.     int         nStart;
  209.     DWORD       dwOptions;
  210. }
  211.  RESULTFINDINFO;
  212. typedef RESULTFINDINFO* LPRESULTFINDINFO;
  213.  
  214. //
  215. // Sort Result Items options
  216. //
  217. const DWORD RSI_DESCENDING = 0x0001;
  218.  
  219.  
  220. const DWORD SDI_STR         = 0x00002;
  221. const DWORD SDI_IMAGE       = 0x00004;
  222. const DWORD SDI_OPENIMAGE   = 0x00008;
  223. const DWORD SDI_STATE       = 0x00010;
  224. const DWORD SDI_PARAM       = 0x00020;
  225. const DWORD SDI_CHILDREN    = 0x00040;
  226.  
  227. // The top 4 bit of the mask determines the relative position of this item,
  228. // relative to the SCOPEDATAITEM::relativeID. By default it is the parent.
  229.  
  230. // For SDI_PARENT, SCOPEDATAITEM::relativeID is the HSCOPEITEM of the parent.
  231. // As you can see by the SDI_PARENT value it is a no-op. Since by default
  232. // SCOPEDATAITEM::relativeID is treated as the parents ID.
  233. const DWORD SDI_PARENT      = 0x00000000;
  234.  
  235. // For SDI_PREVIOUS, SCOPEDATAITEM::relativeID is the HSCOPEITEM of the previous sibling
  236. const DWORD SDI_PREVIOUS    = 0x10000000;
  237.  
  238. // For SDI_NEXT, SCOPEDATAITEM::relativeID is the HSCOPEITEM of the next sibling.
  239. const DWORD SDI_NEXT        = 0x20000000;
  240.  
  241. // For SDI_PARENT, bit 27 determines whether the item is to be inserted as the
  242. // first child. By default this item will inserted as the last child.
  243. const DWORD SDI_FIRST       = 0x08000000;
  244.  
  245.  
  246. typedef struct _SCOPEDATAITEM
  247. {
  248.     DWORD       mask;
  249.     LPOLESTR    displayname;
  250.     int         nImage;
  251.     int         nOpenImage;
  252.     UINT        nState;
  253.     int         cChildren;
  254.     LPARAM      lParam;
  255.     HSCOPEITEM  relativeID;
  256.     HSCOPEITEM  ID;
  257. } SCOPEDATAITEM;
  258.  
  259. typedef SCOPEDATAITEM* LPSCOPEDATAITEM;
  260.  
  261. typedef enum _MMC_SCOPE_ITEM_STATE
  262. {
  263.     MMC_SCOPE_ITEM_STATE_NORMAL = 0x0001,        // Not bold. To set or get.
  264.     MMC_SCOPE_ITEM_STATE_BOLD = 0x0002,          // To set or get.
  265.     MMC_SCOPE_ITEM_STATE_EXPANDEDONCE = 0x0003,  // Only to get.
  266.     
  267. } MMC_SCOPE_ITEM_STATE;
  268.  
  269.  
  270. typedef struct _CONTEXTMENUITEM
  271. {
  272.     LPWSTR      strName;
  273.     LPWSTR      strStatusBarText;
  274.     LONG        lCommandID;
  275.     LONG        lInsertionPointID;
  276.     LONG        fFlags;
  277.     LONG        fSpecialFlags;
  278. } CONTEXTMENUITEM;
  279.  
  280. typedef CONTEXTMENUITEM* LPCONTEXTMENUITEM;
  281.  
  282. //
  283. // Console defined menu command IDs
  284. //   The console reserves the negative numbers for predefined menu command
  285. //   IDs which it sends to a snapin's IExtendContextMenu::Command method  
  286. //
  287. typedef enum _MMC_MENU_COMMAND_IDS
  288. {
  289.     MMCC_STANDARD_VIEW_SELECT = -1
  290. } MMC_MENU_COMMAND_IDS;
  291.  
  292.  
  293.  
  294. //IMenuButton data structure
  295.  
  296. typedef struct _MENUBUTTONDATA
  297. {
  298.     int      idCommand;
  299.     int      x;
  300.     int      y;
  301. } MENUBUTTONDATA;
  302.  
  303. typedef MENUBUTTONDATA* LPMENUBUTTONDATA;
  304.  
  305.  
  306. //  For multi select the cookie passed to the snapins will be 
  307. //  MMC_MULTI_SELECT_COOKIE. The data object that will be returned 
  308. //  should provide the CCF_OBJECT_TYPES_IN_MULTI_SELECT clipboard
  309. //  format.
  310. // 
  311. const long MMC_MULTI_SELECT_COOKIE = -2;
  312.  
  313. // Special cookie value for requesting window properties data object
  314. const long MMC_WINDOW_COOKIE = -3;
  315.  
  316. //IQuickFilter data structure
  317.  
  318. // Published filter constants
  319. #define FILTER_TYPE_STRING  1
  320. #define FILTER_TYPE_INT     3
  321.  
  322. typedef enum _MMC_FILTER_TYPE
  323. {
  324.     MMC_STRING_FILTER = FILTER_TYPE_STRING,
  325.     MMC_INT_FILTER =    FILTER_TYPE_INT
  326. } MMC_FILTER_TYPE;
  327.          
  328. typedef struct _FILTERDATA
  329. {
  330.     DWORD       dwFlags;        // reserved (should be zero)
  331.     DWORD       dwType;            // one of the FILTER_TYPE_<bla> values
  332.     INT         iFilter;        // filter value if int type filter
  333.     LPOLESTR   pszFilter;        // filter value, if string filter
  334.     INT         cchFilter;        // max size of string filter value
  335. } FILTERDATA, *LPFILTERDATA;
  336.  
  337. typedef enum _MMC_FILTER_CHANGE_CODE
  338. {
  339.     MFCC_DISABLE      = 0,
  340.     MFCC_ENABLE       = 1,
  341.     MFCC_VALUE_CHANGE = 2
  342. } MMC_FILTER_CHANGE_CODE;
  343.  
  344. /*
  345. NOTIFICATIONS
  346. =============
  347.  
  348. Notify(dataobject, event, arg, param);
  349.     For all the MMC_NOTIFY_TYPE events, 
  350.     dataobject
  351.         For single select:
  352.             dataobject for cookie, can be NULL when dataobject is not required
  353.         For multi select:
  354.             Console supplied data object. Supports only one format (CCF_MULTI_SELECT_SNAPIN),
  355.             which can be used to accquire an IUnknow to the primary snapin.
  356.     event = one of the MMCN_NOTIFY_TYPEs
  357.     arg and param depend on type, see below.
  358.     
  359. MMCN_ACTIVATE
  360.     Is sent when a window is being activated or deactivated.
  361.     arg = TRUE if window is activated, false otherwise.
  362.     param = Not used.
  363.  
  364. MMCN_ADD_IMAGES
  365.     Sent to IComponent to add images for the result pane. The primary snapin
  366.         should add images for both folders and leaf items. Extension snapins
  367.         should add only folder images. 
  368.     arg = ptr to result panes IImageList.
  369.     param = HSCOPEITEM of selected/deselected item
  370.     
  371. MMCN_BTN_CLICK      
  372.     This message is sent when a user clicks on a button.
  373.     arg   = When sent to ExtendControlbar it is the data object of currently selected,
  374.             when sent to IComponent/IComponentData it is 0.
  375.     param = CmdID of the button equal to a value of the MMC_COMMANDS enum type.
  376.  
  377. MMCN_EXPAND         
  378.     arg = TRUE => expand, FALSE => contract
  379.     param = parents HSCOPEITEM.
  380.     
  381. MMCN_MINIMIZED      
  382.     Is sent when a window is being minimized or maximized.
  383.     arg = TRUE if minimized, false otherwise.
  384.     
  385. MMCN_PROPERTY_CHANGE
  386.     lpDataObject = NULL
  387.     lParam = user object
  388.  
  389. MMCN_REMOVE_CHILDREN
  390.     Informs the snapin to delete all the cookies it has added below.
  391.     arg = HSCOPEITEM of the node whose children needs to be deleted.
  392.     param = unused.
  393.     return = unused.
  394.     
  395. MMCN_RENAME       
  396.     This gets called the first time to query for rename and a
  397.     second time to do the rename.  For the query S_OK or S_FALSE for the
  398.     return type.  After the rename, we will send the new name with a LPOLESTR.
  399.     arg = 0 for query, 1 for rename action 
  400.     param = LPOLESTR for containing new name   
  401.     return = S_OK to allow rename and S_FALSE to disallow rename.                    
  402.  
  403. MMCN_SELECT
  404.     If sent to IComponent::Notify:
  405.         arg:
  406.             BOOL bScope = (BOOL) LOWORD(arg);
  407.             BOOL bSelect = (BOOL) HIWORD(arg);
  408.                 bScope:     TRUE if an item the scope pane is selected, 
  409.                             FALSE if an item in the result pane is selected.
  410.                 bSelect:    TRUE if the item is selected, 
  411.                             FALSE if it is de-selected.
  412.         param: 
  413.             Ignored.                
  414.                 
  415.     If sent to IExtendControlbar::ControlbarNotify:
  416.         arg:
  417.             BOOL bScope = (BOOL) LOWORD(arg);
  418.             BOOL bSelect = (BOOL) HIWORD(arg);
  419.                 bScope:     TRUE if an item the scope pane is selected, 
  420.                             FALSE if an item in the result pane is selected.
  421.                 bSelect:    TRUE if the item is selected,
  422.                             FALSE if it is de-selected.  
  423.         param:
  424.             LPDATAOBJECT pDataobject = (LPDATAOBJECT)param;
  425.             pDataobject data object of item getting selected/de-selected.
  426.  
  427.     
  428. MMCN_SHOW           
  429.     arg = <>0 if selecting, 0 if deselecting
  430.     param = HSCOPEITEM of selected/deselected item
  431.  
  432. MMCN_VIEW_CHANGE    
  433.     This message is sent to update all views of a change.
  434.     arg = TRUE if Scope Item, FALSE if Result Item
  435.     param = ptr to DataObject selected
  436.  
  437. MMCN_MENU_BTNCLICK      
  438.     This message is sent when a user clicks on a button.
  439.     arg   = Data object of currently selected.
  440.     param = Structure (LPMENUBUTTONDATA).
  441.  
  442. MMCN_SNAPINHELP
  443.     This message is sent when the user requests help about the snapin.
  444.     dataObject = NULL
  445.     arg = 0
  446.     param = 0
  447.  
  448. MMCN_CONTEXTHELP
  449.     This message is sent when the user requests help about a selected item
  450.     arg = 0
  451.     param = 0 
  452.  
  453. MMCN_DESELECT_ALL
  454.     This message is sent when all items of an owner-data result pane
  455.     are deselected.
  456.     dataObject = NULL
  457.     arg = 0
  458.     param = 0
  459.     
  460. MMCN_COLUMN_CLICK
  461.     This message is sent when the user clicks on a result listview column header.
  462.     dataObject = NULL
  463.     arg = Column number
  464.     param = Sort option flags (RSI_xxx) 
  465.     
  466. MMCN_DELETE:
  467.     Sent to inform the snapin that the item needs to be deleted. As a result of
  468.     the user hitting the 'Delete' key or delete button.
  469.     dataobject: dataobject of the selected item(s) provided by the snap-in.
  470.     arg, param: unused.
  471.  
  472. MMCN_CUTORMOVE:
  473.     dataobject: NULL.
  474.     arg: pointer to a dataobject. See multi-selection below.
  475.     param: unused.
  476.  
  477. MMCN_QUERY_PASTE:
  478.     dataobject: dataobject of the selected item provided by the snap-in.        
  479.     arg: dataobject of the item(s) provided by the source snap-in that needs to be pasted.
  480.     param: unused.
  481.     Return S_OK if the data can be pasted, S_FALSE otherwise.
  482.  
  483. MMCN_PASTE:
  484.     dataobject & arg: are same as for MMCN_QUERY_PASTE.
  485.     param:
  486.         NULL for move (as opposed to cut).
  487.         For single item paste:
  488.             BOOL* pPasted = (BOOL*)param; 
  489.             Set this to TRUE here if the item was successfully pasted.
  490.         For multi-item paste:
  491.             LPDATAOBJECT* ppDataObj = (LPDATAOBJECT*)param;
  492.             Use this to return a pointer to a dataobject consisting of the 
  493.             items successfully pasted. (see MMCN_CUTORMOVE below).
  494.  
  495. MMCN_FILTER_STATE:
  496.     This message is sent when the user turns result view filtering on or off.
  497.     dataobject = NULL
  498.     arg = BOOL, True if filter turned on, Flase if filter turned off
  499.     param = unused
  500.      
  501. MMCN_FILTER_CHANGE:
  502.     This message is sent when the filter value for a result view column has been changed. 
  503.     dataobject= NULL
  504.     arg = Filter change code (see MMC_FILTER_CHANGE_CODE enumeration)
  505.     param = column number of changed value, if change code is MFCC_VALUE_CHANGE
  506.  
  507. MMCN_GET_FILTER_MENU:
  508.     This message is sent to get the filter operators menu for a result view column.
  509.     dataobject = NULL
  510.     arg = Column number
  511.     param = Pointer to returned menu handle (HMENU)
  512.     
  513. MMCN_FILTER_OPERATOR:
  514.     This message is sent when the user selects an entry from a filter operator menu.
  515.     dataobject = NULL
  516.     arg = Column number
  517.     param = Menu item ID  
  518.  
  519. MMCN_INITOCX:
  520.     Sent to a snap-in when its custom OCX is initialized for the first time.
  521. */
  522.  
  523. typedef enum _MMC_NOTIFY_TYPE
  524. {
  525.     MMCN_ACTIVATE           = 0x8001,
  526.     MMCN_ADD_IMAGES         = 0x8002,
  527.     MMCN_BTN_CLICK          = 0x8003,
  528.     MMCN_CLICK              = 0x8004,
  529.     MMCN_COLUMN_CLICK       = 0x8005,
  530.     MMCN_CONTEXTMENU        = 0x8006,   // NOT USED
  531.     MMCN_CUTORMOVE          = 0x8007,
  532.     MMCN_DBLCLICK           = 0x8008,
  533.     MMCN_DELETE             = 0x8009,
  534.     MMCN_DESELECT_ALL       = 0x800A,
  535.     MMCN_EXPAND             = 0x800B,
  536.     MMCN_HELP               = 0x800C,   // NOT USED
  537.     MMCN_MENU_BTNCLICK      = 0x800D,
  538.     MMCN_MINIMIZED          = 0x800E,
  539.     MMCN_PASTE              = 0x800F,
  540.     MMCN_PROPERTY_CHANGE    = 0x8010,
  541.     MMCN_QUERY_PASTE        = 0x8011,
  542.     MMCN_REFRESH            = 0x8012,
  543.     MMCN_REMOVE_CHILDREN    = 0x8013,
  544.     MMCN_RENAME             = 0x8014,
  545.     MMCN_SELECT             = 0x8015,
  546.     MMCN_SHOW               = 0x8016, 
  547.     MMCN_VIEW_CHANGE        = 0x8017,
  548.     MMCN_SNAPINHELP         = 0x8018,
  549.     MMCN_CONTEXTHELP        = 0x8019,
  550.     MMCN_INITOCX            = 0x801A,   
  551.     MMCN_FILTER_CHANGE      = 0x801B,
  552.     MMCN_GET_FILTER_MENU    = 0x801C,
  553.     MMCN_FILTER_OPERATOR    = 0x801D,
  554.     
  555. } MMC_NOTIFY_TYPE;
  556.  
  557. typedef enum _DATA_OBJECT_TYPES
  558. {
  559.     CCT_SCOPE            = 0x8000, // Data object while for scope pane context
  560.     CCT_RESULT           = 0x8001, // Data object while for result pane context
  561.     CCT_SNAPIN_MANAGER   = 0x8002, // Data object while for snap-in manager context
  562.     CCT_UNINITIALIZED    = 0xFFFF, // Data object has an invalid type
  563.  
  564. } DATA_OBJECT_TYPES;
  565.  
  566.  
  567. //New window option(s)
  568.  
  569. const unsigned long MMC_NW_OPTION_NONE          = 0x0000;
  570.  
  571. // No scope pane
  572. const unsigned long MMC_NW_OPTION_NOSCOPEPANE   = 0x0001;
  573.  
  574. // No standard toolbars
  575. const unsigned long MMC_NW_OPTION_NOTOOLBARS    = 0x0002;
  576.  
  577. // Use short window title                                          
  578. const unsigned long MMC_NW_OPTION_SHORTTITLE    = 0x0004;
  579.  
  580. // Snap-in provides window title
  581. const unsigned long MMC_NW_OPTION_CUSTOMTITLE   = 0x0008;
  582.  
  583. // Do not save view to console doc file
  584. const unsigned long MMC_NW_OPTION_NOPERSIST     = 0x0010;
  585.  
  586.  
  587. ///////////////////////////////////////////////////////////////////////////////
  588. // Common Console clipboard formats
  589. //
  590.  
  591. // Clipboard format for node type guid
  592. const wchar_t* CCF_NODETYPE = L"CCF_NODETYPE"; 
  593.  
  594. // Clipboard format for string version of node type guid
  595. const wchar_t* CCF_SZNODETYPE = L"CCF_SZNODETYPE";
  596.  
  597. // Clipboard format for name displayed in scope pane
  598. const wchar_t* CCF_DISPLAY_NAME = L"CCF_DISPLAY_NAME";
  599.  
  600. // Clipboard format for the snapin's class id.
  601. const wchar_t* CCF_SNAPIN_CLASSID = L"CCF_SNAPIN_CLASSID";
  602.  
  603. // Clipboard format for window title (for window data object)
  604. const wchar_t* CCF_WINDOW_TITLE = L"CCF_WINDOW_TITLE";
  605.  
  606. // This is the MMC supplied Multi-select data object.
  607. const wchar_t* CCF_MMC_MULTISELECT_DATAOBJECT = L"CCF_MMC_MULTISELECT_DATAOBJECT";
  608.  
  609. // Clipboard format for the snapins multi selected dataobjects.
  610. // If there are N snapins whose objects are selected in the result
  611. // pane, these N dataobjects will be passed in a GloballAlloced
  612. // memory. The first DWORD contains the number of snapins, this will
  613. // be followed by N ptrs to the DataObjects.
  614. typedef struct _SMMCDataObjects
  615. {
  616.     DWORD           count;
  617.     LPDATAOBJECT    lpDataObject[1];
  618.     
  619. } SMMCDataObjects;
  620. const wchar_t* CCF_MULTI_SELECT_SNAPINS = L"CCF_MULTI_SELECT_SNAPINS";
  621.  
  622. // Clipboard format for the array of GUIDs which constitutes the object 
  623. // types of all the currently selected result items put by the snapin.
  624. typedef struct _SMMCObjectTypes
  625. {
  626.     DWORD   count;
  627.     GUID    guid[1];
  628.     
  629. } SMMCObjectTypes;
  630.  
  631. const wchar_t* CCF_OBJECT_TYPES_IN_MULTI_SELECT = L"CCF_OBJECT_TYPES_IN_MULTI_SELECT";
  632.  
  633.  
  634.  
  635. ///////////////////////////////////////////////////////////////////////////////
  636. // APIs exported in mmc.lib
  637. //
  638. cpp_quote("STDAPI MMCPropertyChangeNotify(long lNotifyHandle, long param);")
  639. cpp_quote("STDAPI MMCFreeNotifyHandle(long lNotifyHandle);")
  640. cpp_quote("STDAPI MMCPropPageCallback(void* vpsp);")
  641. cpp_quote("EXTERN_C const CLSID CLSID_NodeManager;")
  642.  
  643.  
  644. ///////////////////////////////////////////////////////////////////////////////
  645. // Special dataobjects
  646. //
  647. cpp_quote("#define DOBJ_NULL (LPDATAOBJECT)0 ")
  648. cpp_quote("#define DOBJ_CUSTOMOCX (LPDATAOBJECT)-1 ")
  649. cpp_quote("#define DOBJ_CUSTOMWEB (LPDATAOBJECT)-2 ")
  650.  
  651. ///////////////////////////////////////////////////////////////////////////////
  652. // Macros
  653. //
  654. cpp_quote("#define IS_SPECIAL_DATAOBJECT(d) ((int)(d) >= -10 && (int)(d) <= 0)")
  655. cpp_quote("#define IS_SPECIAL_COOKIE(c) ((c) >= -10 && (c) <= -1)")
  656.  
  657. ///////////////////////////////////////////////////////////////////////////////
  658. //  Interfaces
  659. //
  660.     [
  661.         object,
  662.         uuid(955AB28A-5218-11D0-A985-00C04FD8D565),
  663.         helpstring("IComponentData Interface"),
  664.         pointer_default(unique)
  665.     ]
  666.     interface IComponentData : IUnknown
  667.     {
  668.         [helpstring("Snap-in entry point. Can QI for IConsole & IConsoleNameSpace")]
  669.         HRESULT Initialize([in] LPUNKNOWN pUnknown);
  670.  
  671.         [helpstring("Create a Componet for this ComponetData")]
  672.         HRESULT CreateComponent([out] LPCOMPONENT* ppComponent);
  673.  
  674.         [helpstring("User actions")]
  675.         HRESULT Notify([in] LPDATAOBJECT lpDataObject, [in] MMC_NOTIFY_TYPE event, 
  676.                        [in] long arg, [in] long param);
  677.  
  678.         [helpstring("Release cookies associated with the children of a specific node")]
  679.         HRESULT Destroy();
  680.  
  681.         [helpstring("Returns a data object which may be used to retrieve the context information for the specified cookie")]
  682.         HRESULT QueryDataObject([in] long cookie, [in] DATA_OBJECT_TYPES type,
  683.                                 [out] LPDATAOBJECT* ppDataObject);
  684.  
  685.         [helpstring("Get display info for the name space item")]
  686.         HRESULT GetDisplayInfo([in,out] SCOPEDATAITEM* pScopeDataItem);
  687.  
  688.         [helpstring("The snap-in's compare function for two data objects")]
  689.         HRESULT CompareObjects([in] LPDATAOBJECT lpDataObjectA, [in] LPDATAOBJECT lpDataObjectB);
  690.     };
  691.     
  692.  
  693.     [
  694.         object,
  695.         uuid(43136EB2-D36C-11CF-ADBC-00AA00A80033),
  696.         helpstring("IComponent Interface"),
  697.         pointer_default(unique)
  698.     ]
  699.     interface IComponent : IUnknown
  700.     {
  701.         [helpstring("Snap-in entry point")]
  702.         HRESULT Initialize([in] LPCONSOLE lpConsole);
  703.         
  704.         [helpstring("User actions")]
  705.         HRESULT Notify([in] LPDATAOBJECT lpDataObject, [in] MMC_NOTIFY_TYPE event, 
  706.                        [in] long arg, [in] long param);
  707.                        
  708.         [helpstring("Release cookies associated with the children of a specific node")]
  709.         HRESULT Destroy([in] long cookie);
  710.  
  711.         [helpstring("Returns a data object which may be used to retrieve the context information for the specified cookie")]
  712.         HRESULT QueryDataObject([in] long cookie, [in] DATA_OBJECT_TYPES type,
  713.                                 [out] LPDATAOBJECT* ppDataObject);
  714.                         
  715.         [helpstring("Returns the result view type for the specified cookie")]
  716.         HRESULT GetResultViewType([in] long cookie, [out] LPOLESTR* ppViewType, 
  717.                                   [out] long* pViewOptions);
  718.  
  719.         [helpstring("Get display info for the result item")]
  720.         HRESULT GetDisplayInfo([in,out] RESULTDATAITEM*  pResultDataItem);
  721.  
  722.         [helpstring("The snap-in's compare function for two data objects")]
  723.         HRESULT CompareObjects([in] LPDATAOBJECT lpDataObjectA, [in] LPDATAOBJECT lpDataObjectB);
  724.     };
  725.  
  726.  
  727.     [
  728.         object,
  729.         uuid(E8315A52-7A1A-11D0-A2D2-00C04FD909DD),
  730.         helpstring("Compare interface for sorting result items"),
  731.         pointer_default(unique)
  732.     ]
  733.     interface IResultDataCompare : IUnknown
  734.     {
  735.         [helpstring("Compare two cookies")]
  736.         HRESULT Compare([in] long lUserParam, 
  737.             [in] long cookieA, [in] long cookieB, [in, out] int* pnResult);
  738.     }
  739.  
  740.  
  741.     [
  742.         object,
  743.         uuid(9CB396D8-EA83-11d0-AEF1-00C04FB6DD2C),
  744.         helpstring("Interface for owner data result pane list"),
  745.         pointer_default(unique)
  746.     ]
  747.     interface IResultOwnerData : IUnknown
  748.     {
  749.         [helpstring("Find result item that matches string")]
  750.         HRESULT FindItem([in] LPRESULTFINDINFO pFindInfo, [out] int* pnFoundIndex);
  751.         
  752.         [helpstring("Hint to cache result item data")]
  753.         HRESULT CacheHint ([in] int nStartIndex, [in] int nEndIndex);
  754.         
  755.         [helpstring("Sort result items")]
  756.         HRESULT SortItems([in] int nColumn, [in] DWORD dwSortOptions, [in] long lUserParam); 
  757.     }
  758.  
  759.  
  760.     [
  761.         object,
  762.         uuid(43136EB1-D36C-11CF-ADBC-00AA00A80033),
  763.         helpstring("IConsole Interface"),
  764.         pointer_default(unique)
  765.     ]
  766.     interface IConsole : IUnknown
  767.     {
  768.         [helpstring("Sets IConsoles header interface")]
  769.         HRESULT SetHeader([in] LPHEADERCTRL pHeader);
  770.  
  771.         [helpstring("Sets IConsoles toolbar interface")]
  772.         HRESULT SetToolbar([in] LPTOOLBAR pToolbar);
  773.  
  774.         [helpstring("Queries IConsoles user provided IUnknown")]
  775.         HRESULT QueryResultView([out] LPUNKNOWN* pUnknown);
  776.  
  777.         [helpstring("Queries the IConsole provided image list for the scope pane.")]
  778.         HRESULT QueryScopeImageList([out] LPIMAGELIST* ppImageList);
  779.  
  780.         [helpstring("Queries the IConsole provided image list for the result pane.")]
  781.         HRESULT QueryResultImageList([out] LPIMAGELIST* ppImageList);
  782.  
  783.         [helpstring("Generates a notification to update view(s) because of content change")]
  784.         HRESULT UpdateAllViews([in] LPDATAOBJECT lpDataObject, 
  785.                                [in] long data, 
  786.                                [in] long hint);
  787.         
  788.         [helpstring("Displays a message box")]
  789.         HRESULT MessageBox([in] LPCWSTR lpszText, [in] LPCWSTR lpszTitle,
  790.                            [in] UINT fuStyle, [out] int* piRetval);
  791.  
  792.         [helpstring("Query for the IConsoleVerb.")]
  793.         HRESULT QueryConsoleVerb([out] LPCONSOLEVERB * ppConsoleVerb);
  794.         
  795.         [helpstring("Selects the given scope item.")]
  796.         HRESULT SelectScopeItem([in] HSCOPEITEM hScopeItem);
  797.         
  798.         [helpstring("Returns handle to the main frame window.")]
  799.         HRESULT GetMainWindow([out] HWND* phwnd);
  800.         
  801.         [helpstring("Create a new window rooted at the scope item specified by hScopeItem.")]
  802.         HRESULT NewWindow([in] HSCOPEITEM hScopeItem, [in] unsigned long lOptions);
  803.  
  804.     };
  805.  
  806.  
  807.  
  808.     [
  809.         object,
  810.         uuid(43136EB3-D36C-11CF-ADBC-00AA00A80033),
  811.         helpstring("INodeInit Interface"),
  812.         pointer_default(unique)
  813.     ]
  814.     interface IHeaderCtrl : IUnknown
  815.     {
  816.         const int AUTO_WIDTH = -1;  // Column width is determined by the string length + padding
  817.  
  818.         [helpstring("Add a column to a Default Result view")]
  819.         HRESULT InsertColumn([in] int nCol, [in,] LPCWSTR title, [in] int nFormat, [in] int nWidth);
  820.  
  821.         [helpstring("Remove a column to a Default Result view")]
  822.         HRESULT DeleteColumn([in] int nCol);
  823.  
  824.         [helpstring("Set a columns text")]
  825.         HRESULT SetColumnText([in] int nCol, [in] LPCWSTR title);
  826.  
  827.         [helpstring("Gets a columns text")]
  828.         HRESULT GetColumnText([in] int nCol, [out] LPOLESTR* pText);
  829.  
  830.         [helpstring("Set a columns width")]
  831.         HRESULT SetColumnWidth([in] int nCol, [in] int nWidth);
  832.  
  833.         [helpstring("Gets a columns width")]
  834.         HRESULT GetColumnWidth([in] int nCol, [out] int* pWidth);
  835.     };
  836.  
  837. enum
  838. {
  839. ///////////////////////////////////////////////////////////////////////////////
  840. // The following bits in insertion point / submenu IDs are handled specially:
  841. //
  842. // CCM_INSERTIONPOINTID_MASK_SPECIAL:
  843. //   Insertion points and submenus whose IDs contain any bit in
  844. //   CCM_INSERTIONPOINTID_MASK_SPECIAL have special behavior.  Snap-Ins may use
  845. //   the other bits as they see fit.
  846. // CCM_INSERTIONPOINTID_MASK_SHARED:
  847. //   Insertion points and submenus whose IDs contain CCM_INSERTIONPOINTID_MASK_SHARED
  848. //   are shared between the creator of the context menu, the primary extension and
  849. //   the third-party extension.  Any of these entities adding items to a shared
  850. //   insertion point or submenu, add them to the same insertion point or submenu.
  851. //   Only IContextMenuProvider may create insertion points or submenus with this bit
  852. //   set, unless CCM_INSERTIONPOINTID_MASK_CREATE_PRIMARY is also set, in which case
  853. //   only the primary extension may create them.
  854. // CCM_INSERTIONPOINT_CREATE_PRIMARY:
  855. //   Only the system may add insertion points or submenus for which CCM_INSERTIONPOINT_SHARED
  856. //   is set and this bit is not set.  Only the primary extension may add insertion points
  857. //   or submenus for which both bits are set.  This prevents insertion point ID conflicts
  858. //   between insertion points and submenus created by IContextMenuProvider and those
  859. //   created by the primary extension.
  860. // CCM_INSERTIONPOINTID_MASK_ADD_PRIMARY:
  861. //   If CCM_INSERTIONPOINT_SHARED is set and this bit is not set, then
  862. //   the primary extension may not add to this insertion point or submenu.
  863. // CCM_INSERTIONPOINTID_MASK_ADD_3RDPARTY:
  864. //   If CCM_INSERTIONPOINT_SHARED is set and this bit is not set, then
  865. //   the third-party extensions may not add to this insertion point or submenu.
  866. // CCM_INSERTIONPOINTID_MASK_RESERVED:
  867. //   Insertion points and submenus may not be added with any of these bits set.
  868. // CCM_INSERTIONPOINTID_MASK_FLAGINDEX:
  869. //   This mask extracts the the index field from system insertion point IDs.
  870. //   The index gives the bit position of the associated insertion allowed flag.
  871.    
  872.     CCM_INSERTIONPOINTID_MASK_SPECIAL        = 0xFFFF0000,
  873.     CCM_INSERTIONPOINTID_MASK_SHARED         = 0x80000000,
  874.     CCM_INSERTIONPOINTID_MASK_CREATE_PRIMARY = 0x40000000,
  875.     CCM_INSERTIONPOINTID_MASK_ADD_PRIMARY    = 0x20000000,
  876.     CCM_INSERTIONPOINTID_MASK_ADD_3RDPARTY   = 0x10000000,
  877.     CCM_INSERTIONPOINTID_MASK_RESERVED       = 0x0FFF0000,
  878.     CCM_INSERTIONPOINTID_MASK_FLAGINDEX      = 0x0000001F,
  879.  
  880. ///////////////////////////////////////////////////////////////////////////////
  881. // Use these InsertionPointIDs to add items at the predefined insertion points:
  882. //
  883. // 0
  884. //   This is interpreted the same as CCM_INSERTIONPOINTID_ROOT_MENU (see below).
  885. // CCM_INSERTIONPOINTID_PRIMARY_TOP:
  886. //   The primary extension may use this insertion point to add items to the top of
  887. //   the main context menu.
  888. // CCM_INSERTIONPOINTID_PRIMARY_NEW:
  889. //   The primary extension may use this insertion point to add items to the top of
  890. //   the Create New submenu.
  891. // CCM_INSERTIONPOINTID_PRIMARY_TASK:
  892. //   The primary extension may use this insertion point to add items to the top of
  893. //   the Task submenu.
  894. // CCM_INSERTIONPOINTID_3RDPARTY_NEW:
  895. //   Third-party extensions may use this insertion point to add items to the bottom of
  896. //   the Create New submenu.
  897. // CCM_INSERTIONPOINTID_3RDPARTY_TASK:
  898. //   Third-party extensions may use this insertion point to add items to the bottom of
  899. //   the Task submenu.
  900. // CCM_INSERTIONPOINTID_ROOT_MENU:
  901. //   IContextMenuProvider may use this insertion point to add items to the root menu.
  902. //   Neither primary extensions nor third-party extension may add items to the root
  903. //   menu except through insertion points added by IContextMenuProvider.
  904. //
  905.     CCM_INSERTIONPOINTID_PRIMARY_TOP   = 0xA0000000, // SHARED and ADD_PRIMARY
  906.     CCM_INSERTIONPOINTID_PRIMARY_NEW   = 0xA0000001, // SHARED and ADD_PRIMARY
  907.     CCM_INSERTIONPOINTID_PRIMARY_TASK  = 0xA0000002, // SHARED and ADD_PRIMARY
  908.     CCM_INSERTIONPOINTID_PRIMARY_VIEW  = 0xA0000003, // SHARED and ADD_PRIMARY
  909.     CCM_INSERTIONPOINTID_3RDPARTY_NEW  = 0x90000001, // SHARED and ADD_3RDPARTY
  910.     CCM_INSERTIONPOINTID_3RDPARTY_TASK = 0x90000002, // SHARED and ADD_3RDPARTY
  911.     CCM_INSERTIONPOINTID_ROOT_MENU     = 0x80000000  // SHARED
  912. };
  913.  
  914. //
  915. // Macro to derive an insertion allowed flag from an system insertion point ID
  916. //
  917. #define INSERTALLOWED_FLAG(insertionID) \
  918.          (1L << (insertionID & CCM_INSERTIONPOINTID_MASK_FLAGINDEX)) 
  919. enum
  920. {
  921. /////////////////////////////////////////////////////////////////////////////////////  
  922. // These flags give permission to insert menu items at the CCM_INSERTIONPOINTID_xxx
  923. // insertion points define above. The bit position of each flag is derived from the
  924. // index portion of the corresponding insertion point ID. They are passed to the
  925. // snap-in's AddMenuItems method.  
  926.  
  927.    CCM_INSERTIONALLOWED_TOP  = INSERTALLOWED_FLAG(CCM_INSERTIONPOINTID_PRIMARY_TOP),
  928.    CCM_INSERTIONALLOWED_NEW  = INSERTALLOWED_FLAG(CCM_INSERTIONPOINTID_PRIMARY_NEW),
  929.    CCM_INSERTIONALLOWED_TASK = INSERTALLOWED_FLAG(CCM_INSERTIONPOINTID_PRIMARY_TASK),
  930.    CCM_INSERTIONALLOWED_VIEW = INSERTALLOWED_FLAG(CCM_INSERTIONPOINTID_PRIMARY_VIEW)
  931. };
  932.  
  933.  
  934. enum
  935. {
  936. ///////////////////////////////////////////////////////////////////////////////
  937. // The following bits in menu command IDs are handled specially:
  938. //
  939. // CCM_COMMANDID_MASK_RESERVED:
  940. //   Items other than insertion points and submenus may not be added with any of
  941. //   these bits set.
  942. // 
  943.     CCM_COMMANDID_MASK_RESERVED       = 0xFFFF0000
  944. };
  945.  
  946. enum
  947. {
  948. ///////////////////////////////////////////////////////////////////////////////
  949. // The following flags may be passed via AddMenuItem parameter fSpecialFlags:
  950. //
  951. // CCM_SPECIAL_SEPARATOR
  952. //   Ignore all other parameters except lInsertionPointID.  Add a separator to the
  953. //   end of the menu or the specified insertion point, except that
  954. //   CCM_SPECIAL_SEPARATOR will never add a separator as the first or last item
  955. //   in a menu/submenu, and if two or more consecutive CCM_SPECIAL_SEPARATORs are added,
  956. //   only one appears in the menu.  Only IContextMenuProvider is permitted to add
  957. //   separators, either special or otherwise, to menus created by IContextMenuProvider.
  958. //
  959.     CCM_SPECIAL_SEPARATOR         = 0x0001,
  960. //
  961. // CCM_SPECIAL_SUBMENU
  962. //   If this submenu is empty, then it will be grayed and disabled.
  963. //   This is only valid for MF_POPUP items.
  964. //
  965.     CCM_SPECIAL_SUBMENU           = 0x0002,
  966. //
  967. // CCM_SPECIAL_DEFAULT_ITEM
  968. //   This should be the default menu item.  If more than one menu item specifies this flag,
  969. //   the last one in each submenu takes precedence.
  970. //
  971.     CCM_SPECIAL_DEFAULT_ITEM      = 0x0004,
  972. //
  973. // CCM_SPECIAL_INSERTION_POINT
  974. //   Ignore all other parameters except lCommandID and lInsertionPointID.  This creates
  975. //   a new "insertion point" at the end of the insertion point or submenu identified by
  976. //   lInsertionPointID (0 is the end of the main menu).  Subsequent calls may use
  977. //   the lCommandID from this call as their lInsertionPointID, and insert their own
  978. //   menu items, submenus or insertion points at this point in this menu.
  979. //
  980.     CCM_SPECIAL_INSERTION_POINT   = 0x0008,
  981. //
  982. // CCM_SPECIAL_TESTONLY
  983. //   Perform the normal validation of the menu item parameters and return the appropriate
  984. //   result code, but do not actually add the menu item. 
  985. //
  986.     CCM_SPECIAL_TESTONLY          = 0x0010     
  987. };
  988.  
  989.  
  990.     [
  991.         object,
  992.         uuid(43136EB7-D36C-11CF-ADBC-00AA00A80033),
  993.         helpstring("IContextMenuCallback Interface"),
  994.         pointer_default(unique)
  995.     ]
  996.     interface IContextMenuCallback : IUnknown
  997.     {
  998.         // returns S_OK if the item was added
  999.         // returns E_INVALIDARG if given a NULL pointer
  1000.         // returns E_INVALIDARG if an item already exists with this lCommandID
  1001.         // returns E_INVALIDARG if insertion point ID could not be found
  1002.         // returns E_INVALIDARG if command ID or insertion point ID is invalid
  1003.         // returns E_INVALIDARG if fFlags contains MF_OWNERDRAW or MF_BITMAP
  1004.         // returns E_INVALIDARG if an extension attempts to add an item where
  1005.         //   fFlags contains MF_SEPARATOR or fSpecialFlags contains CCM_SPECIAL_SEPARATOR
  1006.         //   except in submenus created by extensions
  1007.         // otherwise an unexpected error occurred
  1008.         [helpstring("Adds one item to context menu")]
  1009.         HRESULT AddItem([in] CONTEXTMENUITEM* pItem);
  1010.     };
  1011.  
  1012.  
  1013.  
  1014.     [
  1015.         object,
  1016.         uuid(43136EB6-D36C-11CF-ADBC-00AA00A80033),
  1017.         object,
  1018.         helpstring("IContextMenuProvider Interface"),
  1019.         pointer_default(unique)
  1020.     ]
  1021.     //
  1022.     // Note that this derives from IContextMenuCallback
  1023.     //
  1024.     interface IContextMenuProvider : IContextMenuCallback
  1025.     {
  1026.         // Methods
  1027.         // returns S_OK unless an unexpected error occurs
  1028.         [helpstring("Clear context menu")]
  1029.         HRESULT EmptyMenuList();
  1030.  
  1031.         // returns S_OK if successful
  1032.         // returns E_INVALIDARG on NULL parameter
  1033.         // passes through return code from IExtendContextMenu::AddMenuItems
  1034.         //   or from CoCreateInstance
  1035.         // otherwise an unexpected error occurred
  1036.         [helpstring("Allow the primary extension to add to bottom of context menu")]
  1037.         HRESULT AddPrimaryExtensionItems([in] LPUNKNOWN piExtension, [in] LPDATAOBJECT piDataObject);
  1038.  
  1039.         // returns S_OK if successful
  1040.         // returns E_INVALIDARG on NULL parameter
  1041.         // returns S_FALSE if context menu has already been extended
  1042.         // passes through return code from IExtendContextMenu::AddMenuItems
  1043.         //   or from CLSIDToString or CoCreateInstance
  1044.         // otherwise an unexpected error occurred
  1045.         [helpstring("Allow third-party extensions to add to bottom of context menu")]
  1046.         HRESULT AddThirdPartyExtensionItems([in] LPDATAOBJECT piDataObject);
  1047.  
  1048.         // returns S_OK unless an unexpected error occurs
  1049.         [helpstring("Display context menu")]
  1050.         HRESULT ShowContextMenu([in] HWND hwndParent, [in] long xPos, [in] long yPos, [out,retval] long* plSelected);
  1051.     };
  1052.  
  1053.  
  1054.     [
  1055.         object,
  1056.         uuid(4F3B7A4F-CFAC-11CF-B8E3-00C04FD8D5B0),
  1057.         helpstring("IExtendContextMenu Interface"),
  1058.         pointer_default(unique)
  1059.     ]
  1060.     interface IExtendContextMenu : IUnknown
  1061.     {
  1062.         [helpstring("Extension may add context menu items via callback interface")]
  1063.         HRESULT AddMenuItems([in] LPDATAOBJECT piDataObject,
  1064.                              [in] LPCONTEXTMENUCALLBACK piCallback,
  1065.                              [in,out] long *pInsertionAllowed);
  1066.  
  1067.         [helpstring("Extension context menu item was selected")]
  1068.         HRESULT Command([in] long lCommandID, [in] LPDATAOBJECT piDataObject);
  1069.     };
  1070.  
  1071.     [
  1072.         object,
  1073.         uuid(43136EB8-D36C-11CF-ADBC-00AA00A80033),
  1074.         helpstring("IImageList Interface"),
  1075.         pointer_default(unique)
  1076.     ]
  1077.     interface IImageList : IUnknown
  1078.     {
  1079.         [helpstring("Sets an Icon in the image list, creates it if it is not there.")]
  1080.         HRESULT ImageListSetIcon([in] long* pIcon, [in] long nLoc);
  1081.  
  1082.         [helpstring("Sets a strip in the image list, starting at nLoc using a pair of bitmaps.")]
  1083.         HRESULT ImageListSetStrip([in] long* pBMapSm,
  1084.             [in] long* pBMapLg,[in] long nStartLoc, [in] COLORREF cMask);
  1085.     };
  1086.  
  1087.     
  1088.  
  1089.     [
  1090.         object,
  1091.         uuid(31DA5FA0-E0EB-11cf-9F21-00AA003CA9F6),
  1092.         helpstring("IResultData Interface"),
  1093.         pointer_default(unique)
  1094.     ]
  1095.     interface IResultData : IUnknown
  1096.     {
  1097.         [helpstring("Allows the snap-in to insert a single item.")]
  1098.         HRESULT InsertItem([in,out] LPRESULTDATAITEM item);
  1099.  
  1100.         [helpstring("Allows the snap-in to delete a single item.")]
  1101.         HRESULT DeleteItem([in] HRESULTITEM itemID, [in] int nCol);
  1102.  
  1103.         [helpstring("Allows the snap-in to find an item/subitem based on its user inserted lParam.")]
  1104.         HRESULT FindItemByLParam([in] LPARAM lParam, [out] HRESULTITEM *pItemID);
  1105.  
  1106.         [helpstring("Allows the snap-in to delete all the items.")]
  1107.         HRESULT DeleteAllRsltItems();
  1108.  
  1109.         [helpstring("Allows the snap-in to set a single item.")]
  1110.         HRESULT SetItem([in] LPRESULTDATAITEM item);
  1111.  
  1112.         [helpstring("Allows the snap-in to get a single item.")]
  1113.         HRESULT GetItem([in,out] LPRESULTDATAITEM item);
  1114.  
  1115.         [helpstring("Returns the lParam of the first item, which matches the given state.")]
  1116.         HRESULT GetNextItem([in,out] LPRESULTDATAITEM item);
  1117.       
  1118.         [helpstring("Allows the snap-in to modify the state of an item.")]
  1119.         HRESULT ModifyItemState([in] int nIndex, [in] HRESULTITEM itemID,
  1120.                                 [in] UINT uAdd, [in] UINT uRemove);
  1121.  
  1122.         [helpstring("Allows the snap-in to set the result view style.")]
  1123.         HRESULT ModifyViewStyle([in] MMC_RESULT_VIEW_STYLE add, 
  1124.                              [in] MMC_RESULT_VIEW_STYLE remove);
  1125.  
  1126.         [helpstring("Allows the snap-in to set the result view mode.")]
  1127.         HRESULT SetViewMode([in] long lViewMode);
  1128.  
  1129.         [helpstring("Allows the snap-in to get the result view mode.")]
  1130.         HRESULT GetViewMode([out] long* lViewMode);
  1131.  
  1132.         [helpstring("Allows the snap-in to update a single item.")]
  1133.         HRESULT UpdateItem([in] HRESULTITEM itemID);
  1134.  
  1135.         [helpstring("Sort all items in result pane")]
  1136.         HRESULT Sort([in] int nColumn, [in] DWORD dwSortOptions, [in] long lUserParam);
  1137.  
  1138.         [helpstring("Set the description bar text for the result view")]
  1139.         HRESULT SetDescBarText([in] LPOLESTR DescText);
  1140.  
  1141.         [helpstring("Set number of items in result pane list")]
  1142.         HRESULT SetItemCount([in] int nItemCount, [in] DWORD dwOptions);
  1143.         
  1144.     };
  1145.  
  1146.  
  1147.     [
  1148.         object,
  1149.         uuid(9757abb8-1b32-11d1-a7ce-00c04fd8d565),
  1150.         helpstring("IQuickFilter Interface"),
  1151.         pointer_default(unique)
  1152.     ]
  1153.     interface IQuickFilter : IUnknown
  1154.     {
  1155.         [helpstring("Sets the time out for the quick filter")]
  1156.         HRESULT SetChangeTimeOut([in] unsigned long uTimeout);
  1157.         
  1158.         [helpstring("Sets the quick filter")]
  1159.         HRESULT SetQuickFilter([in] UINT nColumn, [in] LPFILTERDATA);
  1160.         
  1161.         [helpstring("Gets the quick filter")]
  1162.         HRESULT GetQuickFilter([in] UINT nColumn, [out] LPFILTERDATA);
  1163.     };
  1164.     
  1165.  
  1166.  
  1167.     [
  1168.         object,
  1169.         uuid(BEDEB620-F24D-11cf-8AFC-00AA003CA9F6),
  1170.         helpstring("IConsoleNameSpace Interface"),
  1171.         pointer_default(unique)
  1172.     ]
  1173.     interface IConsoleNameSpace : IUnknown
  1174.     {
  1175.         import "oaidl.idl";
  1176.         [helpstring("Allows the snap-in to insert a single item into the scope view.")]
  1177.         HRESULT InsertItem([in,out] LPSCOPEDATAITEM  item);
  1178.  
  1179.         [helpstring("Allows the snap-in to delete a single item from the scope view.")]
  1180.         HRESULT DeleteItem([in] HSCOPEITEM hItem, [in] long fDeleteThis);
  1181.  
  1182.         [helpstring("Allows the snap-in to set a single scope view item.")]
  1183.         HRESULT SetItem([in] LPSCOPEDATAITEM item);
  1184.  
  1185.         [helpstring("Allows the snap-in to get a single scope view item.")]
  1186.         HRESULT GetItem([in,out] LPSCOPEDATAITEM item);
  1187.         
  1188.         [helpstring("The handle of the child item if successful, otherwise NULL.")]
  1189.         HRESULT GetChildItem([in] HSCOPEITEM item, [out] HSCOPEITEM* pItemChild,
  1190.                              [out] long* plCookie);
  1191.         
  1192.         [helpstring("The handle of the next item if successful, otherwise NULL.")]
  1193.         HRESULT GetNextItem([in] HSCOPEITEM item, [out] HSCOPEITEM* pItemNext,
  1194.                             [out] long* plCookie);
  1195.                             
  1196.         [helpstring("The handle of the parent item if successful, otherwise NULL.")]
  1197.         HRESULT GetParentItem([in] HSCOPEITEM item, [out] HSCOPEITEM* pItemParent,
  1198.                               [out] long* plCookie);
  1199.     };
  1200.  
  1201. struct _PSP;
  1202. typedef struct _PSP * HPROPSHEETPAGE;
  1203.  
  1204.     [
  1205.         local,
  1206.         object,
  1207.         uuid(85DE64DD-EF21-11cf-A285-00C04FD8DBE6),
  1208.         helpstring("IPropertySheetCallback Interface"),
  1209.         pointer_default(unique)
  1210.     ]
  1211.     interface IPropertySheetCallback : IUnknown
  1212.     {
  1213.  
  1214.         [helpstring("Snap-in uses this to add a page to a property sheet")]
  1215.         HRESULT AddPage([in] HPROPSHEETPAGE hPage);
  1216.  
  1217.         [helpstring("Snap-in uses this to remove a page from a property sheet")]
  1218.         HRESULT RemovePage([in] HPROPSHEETPAGE  hPage);
  1219.     };
  1220.  
  1221.     [
  1222.         object,
  1223.         uuid(85DE64DE-EF21-11cf-A285-00C04FD8DBE6),
  1224.         helpstring("IPropertySheetProvider Interface"),
  1225.         pointer_default(unique)
  1226.     ]
  1227.     interface IPropertySheetProvider : IUnknown
  1228.     {
  1229.         [helpstring("Creates a property sheet frame")]
  1230.         HRESULT CreatePropertySheet([in] LPCWSTR title, [in] boolean type, 
  1231.                                     [in] long cookie, [in] LPDATAOBJECT pIDataObjectm,
  1232.                                     [in] DWORD dwOptions);
  1233.  
  1234.         [helpstring("Determine if the property sheet exist")]
  1235.         HRESULT FindPropertySheet([in] long cookie, [in] LPCOMPONENT lpComponent, [in] LPDATAOBJECT lpDataObject);
  1236.  
  1237.         [helpstring("Collects the pages from the primary snap-in")]
  1238.         HRESULT AddPrimaryPages(LPUNKNOWN lpUnknown, BOOL bCreateHandle, HWND hNotifyWindow, BOOL bScopePane);
  1239.  
  1240.         [helpstring("Collects the pages from the extension snap-in(s)")]
  1241.         HRESULT AddExtensionPages();
  1242.  
  1243.         [helpstring("Shows a property sheet frame parented to the HWND passed in")]
  1244.         HRESULT Show([in] long window, [in] int page);
  1245.     };
  1246.  
  1247.     [
  1248.         object,
  1249.         uuid(85DE64DC-EF21-11cf-A285-00C04FD8DBE6),
  1250.         helpstring("IExtendPropertySheet Interface"),
  1251.         pointer_default(unique)
  1252.     ]
  1253.     interface IExtendPropertySheet : IUnknown
  1254.     {
  1255.         [helpstring("Interface implemented by the snap-in to add pages to a sheet")]
  1256.         // handle - This handle must be saved in the property page object 
  1257.         //          to notify the parent of changes in property using API 
  1258.         //          MMCPropertyChangeNotify. The API MMCFreeNotifyHandle
  1259.         //          should be called just before the property page is
  1260.         //          destroyed to delete the handle.
  1261.         HRESULT CreatePropertyPages([in] LPPROPERTYSHEETCALLBACK lpProvider,
  1262.                                     [in] long handle, 
  1263.                                     [in] LPDATAOBJECT lpIDataObject);
  1264.  
  1265.         [helpstring("Interface implemented by the snap-in to determine if this object needs pages")]
  1266.         HRESULT QueryPagesFor([in] LPDATAOBJECT lpDataObject);
  1267.     };
  1268.  
  1269.  
  1270.  
  1271.     [
  1272.         object,
  1273.         uuid(69FB811E-6C1C-11D0-A2CB-00C04FD909DD),
  1274.         helpstring("Control bar to hold toolbar and other controls"),
  1275.         pointer_default(unique)
  1276.     ]
  1277.     interface IControlbar : IUnknown
  1278.     {
  1279.         [helpstring("Create and return the control requested")]
  1280.         HRESULT Create([in] MMC_CONTROL_TYPE nType, 
  1281.                        [in] LPEXTENDCONTROLBAR pExtendControlbar,
  1282.                        [out] LPUNKNOWN* ppUnknown);
  1283.  
  1284.         [helpstring("Associated the control to the control bar")]
  1285.         HRESULT Attach([in] MMC_CONTROL_TYPE nType, [in] LPUNKNOWN  lpUnknown);
  1286.  
  1287.         [helpstring("Break the association between the control and the control bar")]
  1288.         HRESULT Detach([in] LPUNKNOWN lpUnknown);
  1289.     };
  1290.  
  1291.     [
  1292.         object,
  1293.         uuid(49506520-6F40-11D0-A98B-00C04FD8D565),
  1294.         helpstring("IExtendControlbar Interface"),
  1295.         pointer_default(unique)
  1296.     ]
  1297.     interface IExtendControlbar : IUnknown
  1298.     {
  1299.         [helpstring("Extension may add toolbars via callback interface")]
  1300.         HRESULT SetControlbar([in] LPCONTROLBAR pControlbar);
  1301.         
  1302.         [helpstring("User actions")]
  1303.         HRESULT ControlbarNotify([in] MMC_NOTIFY_TYPE event, 
  1304.                                  [in] long arg, [in] long param);
  1305.     };
  1306.  
  1307.  
  1308.     [
  1309.         object,
  1310.         uuid(43136EB9-D36C-11CF-ADBC-00AA00A80033),
  1311.         pointer_default(unique)
  1312.     ]
  1313.     interface IToolbar : IUnknown
  1314.     {
  1315.         [helpstring("Add and image to the toolbar")]
  1316.         HRESULT AddBitmap([in] int nImages, [in] HBITMAP hbmp, [in] int cxSize, [in] int cySize, [in] COLORREF crMask );
  1317.     
  1318.         [helpstring("Add an array of buttons to the toolbar")]
  1319.         HRESULT AddButtons([in] int nButtons, [in] LPMMCBUTTON lpButtons);
  1320.  
  1321.         [helpstring("Add a single button to the toolbar at position nIndex")]
  1322.         HRESULT InsertButton([in] int nIndex, [in] LPMMCBUTTON lpButton); 
  1323.  
  1324.         [helpstring("Remove a button at the index")]
  1325.         HRESULT DeleteButton([in] int nIndex);
  1326.     
  1327.         [helpstring("Get an attribute of a button")]
  1328.         HRESULT GetButtonState([in] int idCommand, [in] MMC_BUTTON_STATE nState, [out] BOOL* pState);
  1329.  
  1330.         [helpstring("Set an attribute of a button")]
  1331.         HRESULT SetButtonState([in] int idCommand, [in] MMC_BUTTON_STATE nState, [in] BOOL bState);
  1332.     };
  1333.  
  1334.  
  1335.     [
  1336.         object,
  1337.         uuid(E49F7A60-74AF-11D0-A286-00C04FD8FE93),
  1338.         pointer_default(unique)
  1339.     ]
  1340.     interface IConsoleVerb : IUnknown
  1341.     {
  1342.         [helpstring("Get verb state")]
  1343.         HRESULT GetVerbState([in] MMC_CONSOLE_VERB eCmdID, [in] MMC_BUTTON_STATE nState, [out] BOOL* pState);
  1344.  
  1345.         [helpstring("Set verb state")]
  1346.         HRESULT SetVerbState([in] MMC_CONSOLE_VERB eCmdID, [in] MMC_BUTTON_STATE nState, [in] BOOL bState);
  1347.                           
  1348.         [helpstring("Set default verb")]
  1349.         HRESULT SetDefaultVerb([in] MMC_CONSOLE_VERB eCmdID);
  1350.         
  1351.         [helpstring("Get default verb")]
  1352.         HRESULT GetDefaultVerb([out] MMC_CONSOLE_VERB* peCmdID);
  1353.     };
  1354.  
  1355.  
  1356.     [
  1357.         object,
  1358.         uuid(1245208C-A151-11D0-A7D7-00C04FD909DD),
  1359.         pointer_default(unique)
  1360.     ]
  1361.     interface ISnapinAbout : IUnknown
  1362.     {
  1363.         [helpstring("Text for the snap-in description box")]
  1364.         HRESULT GetSnapinDescription([  out] LPOLESTR* lpDescription);
  1365.  
  1366.         [helpstring("Provider name")]
  1367.         HRESULT GetProvider([out] LPOLESTR* lpName);
  1368.  
  1369.         [helpstring("Version number for the snap-in")]
  1370.         HRESULT GetSnapinVersion([out] LPOLESTR* lpVersion);
  1371.  
  1372.         [helpstring("Main icon for about box")]
  1373.         HRESULT GetSnapinImage([out] HICON* hAppIcon);
  1374.  
  1375.         [helpstring("Static folder images for scope and result panes")]
  1376.         HRESULT GetStaticFolderImage([out] HBITMAP* hSmallImage, 
  1377.                                      [out] HBITMAP* hSmallImageOpen, 
  1378.                                      [out] HBITMAP* hLargeImage, 
  1379.                                      [out] COLORREF* cMask);
  1380.     };
  1381.  
  1382.  
  1383.     [
  1384.         object,
  1385.         uuid(951ED750-D080-11d0-B197-000000000000),
  1386.         pointer_default(unique)
  1387.     ]
  1388.     interface IMenuButton : IUnknown
  1389.     {
  1390.         [helpstring("Adds a button")]
  1391.         HRESULT AddButton([in] int idCommand,[in] LPOLESTR lpButtonText,
  1392.                                              [in] LPOLESTR lpTooltipText);
  1393.  
  1394.         [helpstring("Set an attributes of a button")]
  1395.         HRESULT SetButton([in] int idCommand,[in] LPOLESTR lpButtonText,
  1396.                                              [in] LPOLESTR lpTooltipText);
  1397.  
  1398.         [helpstring("Set the state of a button")]
  1399.         HRESULT SetButtonState([in] int idCommand, 
  1400.                                [in] MMC_BUTTON_STATE nState, 
  1401.                                [in] BOOL bState);
  1402.     };
  1403.  
  1404.  
  1405.  
  1406.     [
  1407.         object,
  1408.         uuid(A6B15ACE-DF59-11D0-A7DD-00C04FD909DD),
  1409.         pointer_default(unique)
  1410.     ]
  1411.     interface ISnapinHelp : IUnknown
  1412.     {
  1413.         [helpstring("Get the compiled help file (.chm) from a snap-in to merge")]
  1414.         HRESULT GetHelpTopic([out] LPOLESTR* lpCompiledHelpFile);
  1415.     }
  1416.