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

  1. //-------------------------------------------------------------
  2. // mmcEnumsAndStructs.cs
  3. //
  4. // Contains enumerations, constants,  and structure definitions used
  5. // by an MMC snapin
  6. //
  7. // NOTE: This is not an all-encompasing list of every enumeration
  8. // and structure defination available to a snapin... just those used
  9. // by this snapin.
  10. //-------------------------------------------------------------
  11.  
  12. using System;
  13. using System.Runtime.InteropServices;
  14.  
  15. namespace Microsoft.SampleMMC
  16. {
  17. //-------------------------------------------\\
  18. //          Enums and Constants              \\
  19. //-------------------------------------------\\
  20.  
  21. public class MMCLV
  22. {
  23.     public const int AUTO                   = -1;
  24. }// class MMCLV
  25.  
  26. public class LVCFMT
  27. {
  28.     public const int LEFT                   = 0x0000;
  29.     public const int RIGHT                  = 0x0001;
  30.     public const int CENTER                 = 0x0002;
  31.     public const int JUSTIFYMASK            = 0x0003;
  32.     public const int IMAGE                  = 0x0800;
  33.     public const int BITMAP_ON_RIGHT        = 0x1000;
  34.     public const int COL_HAS_IMAGES         = 0x8000;
  35. }// class LVCFMT
  36.  
  37. public class TBSTATE
  38. {
  39.     public const byte CHECKED               = 0x01;
  40.     public const byte PRESSED               = 0x02;
  41.     public const byte ENABLED               = 0x04;
  42.     public const byte HIDDEN                = 0x08;
  43.     public const byte INDETERMINATE         = 0x10;
  44.     public const byte WRAP                  = 0x20;
  45.     public const byte ELLIPSES              = 0x40;
  46.     public const byte MARKED                = 0x80;
  47. }// class TBSTATE
  48.  
  49. public class TBSTYLE
  50. {
  51.     public const byte BUTTON                = 0x0000;
  52.     public const byte SEP                   = 0x0001;
  53.     public const byte CHECK                 = 0x0002;
  54.     public const byte GROUP                 = 0x0004;
  55.     public const byte CHECKGROUP            = (GROUP | CHECK);
  56.     public const byte DROPDOWN              = 0x0008;
  57.     public const byte AUTOSIZE              = 0x0010;
  58.     public const byte NOPREFIX              = 0x0020;
  59. }// class TBSTYLE
  60.  
  61. public class EN
  62. {
  63.     public const uint SETFOCUS           = 0x0100;
  64.     public const uint KILLFOCUS          = 0x0200;
  65.     public const uint CHANGE             = 0x0300;
  66.     public const uint UPDATE             = 0x0400;
  67.     public const uint ERRSPACE           = 0x0500;
  68.     public const uint MAXTEXT            = 0x0501;
  69.     public const uint HSCROLL            = 0x0601;
  70.     public const uint VSCROLL            = 0x0602;
  71. }// EN
  72.  
  73. public class PSM
  74. {
  75.  
  76.     public const uint SETCURSEL          = (0x0400 + 101);
  77.     public const uint REMOVEPAGE         = (0x0400 + 102);
  78.     public const uint ADDPAGE            = (0x0400 + 103);
  79.     public const uint CHANGED            = (0x0400 + 104);
  80. }// PSM
  81.  
  82. public class PSN
  83. {
  84.     public const uint FIRST              = unchecked((0U-200U));
  85.     public const uint LAST               = unchecked((0U-299U));
  86.     public const uint SETACTIVE          = unchecked((FIRST-0));
  87.     public const uint KILLACTIVE         = unchecked((FIRST-1));
  88.     public const uint APPLY              = unchecked((FIRST-2));
  89.     public const uint RESET              = unchecked((FIRST-3));
  90.     public const uint HELP               = unchecked((FIRST-5));
  91.     public const uint WIZBACK            = unchecked((FIRST-6));
  92.     public const uint WIZNEXT            = unchecked((FIRST-7));
  93.     public const uint WIZFINISH          = unchecked((FIRST-8));
  94.     public const uint QUERYCANCEL        = unchecked((FIRST-9));
  95.     public const uint GETOBJECT          = unchecked((FIRST-10));
  96. }// PSN
  97.  
  98. // Constants for Window Messages
  99. public class WM
  100. {
  101.     public const uint INITDIALOG            = 0x0110;
  102.     public const uint COMMAND               = 0x0111;
  103.     public const uint DESTROY               = 0x0002;
  104.     public const uint NOTIFY                = 0x004E;
  105. }// WM
  106.  
  107. // Constants required for the Property Sheet Page Callback function
  108. public class PSPCB
  109. {
  110.     public const uint ADDREF                = 0;
  111.     public const uint RELEASE               = 1;
  112.     public const uint CREATE                = 2;
  113. }// PSPCB
  114.     
  115. public class PSP
  116. {
  117.     public const uint DEFAULT               = 0x00000000;
  118.     public const uint DLGINDIRECT           = 0x00000001;
  119.     public const uint USEHICON              = 0x00000002;
  120.     public const uint USEICONID             = 0x00000004;
  121.     public const uint USETITLE              = 0x00000008;
  122.     public const uint RTLREADING            = 0x00000010;
  123.  
  124.     public const uint HASHELP               = 0x00000020;
  125.     public const uint USEREFPARENT          = 0x00000040;
  126.     public const uint USECALLBACK           = 0x00000080;
  127.     public const uint PREMATURE             = 0x00000400;
  128.  
  129.     public const uint HIDEHEADER            = 0x00000800;
  130.     public const uint USEHEADERTITLE        = 0x00001000;
  131.     public const uint USEHEADERSUBTITLE     = 0x00002000;
  132. }// class PSP
  133.  
  134. public class HRESULT
  135. {
  136.     public const int S_OK                  = 0;
  137.     public const int S_FALSE               = 1;
  138.     public const int E_NOTIMPL             = unchecked((int)0x80004001);
  139. }// HRESULT
  140.  
  141. public class IMAGE
  142. {
  143.     public const int BITMAP                = 0;
  144.     public const int CURSOR                = 1;
  145.     public const int ICON                  = 2;
  146. }// class IMAGE_TYPES        
  147.  
  148. public class CCT
  149. {
  150.     public const uint SCOPE            = 0x8000; // Data object for scope pane context 
  151.     public const uint RESULT           = 0x8001; // Data object for result pane context 
  152.     public const uint SNAPIN_MANAGER   = 0x8002; // Data object for Snap-in Manager context 
  153.     public const uint UNINITIALIZED    = 0xFFFF;  // Data object has an invalid type 
  154. }// class CCT
  155.  
  156. public class MMC_BUTTON_STATE
  157. {
  158.     public const uint ENABLED                = 0x1;
  159.     public const uint CHECKED                = 0x2;
  160.     public const uint HIDDEN                = 0x4;
  161.     public const uint INDETERMINATE            = 0x8;
  162.     public const uint BUTTONPRESSED            = 0x10;
  163. }// class MMC_BUTTON_STATE
  164.  
  165. public class MMC_VERB                               
  166. {                                                            
  167.     public const uint NONE            = 0x0000;                       
  168.     public const uint OPEN            = 0x8000;                       
  169.     public const uint COPY            = 0x8001;                       
  170.     public const uint PASTE           = 0x8002;                       
  171.     public const uint DELETE          = 0x8003;                       
  172.     public const uint PROPERTIES      = 0x8004;                       
  173.     public const uint RENAME          = 0x8005;                       
  174.     public const uint REFRESH         = 0x8006;                       
  175.     public const uint PRINT           = 0x8007;                       
  176.     public const uint CUT             = 0x8008;
  177.                                                              
  178.     public const uint MAX             = 0x8009;                                            
  179.     public const uint FIRST           = OPEN;                
  180.     public const uint LAST            = MAX - 1;             
  181. }// class MMC_VERB                            
  182.  
  183. public enum MMC_CONTROL_TYPE
  184. {
  185.     TOOLBAR                    = 0,
  186.     MENUBUTTON                = TOOLBAR + 1,
  187.     COMBOBOXBAR                = MENUBUTTON + 1
  188. }// enum MMC_CONTROL_TYPE
  189.  
  190. public class CCM
  191. {    
  192.     public const uint INSERTIONALLOWED_TOP    = 1;
  193.     public const uint INSERTIONALLOWED_NEW    = 2;
  194.     public const uint INSERTIONALLOWED_TASK    = 4;
  195.     public const uint INSERTIONALLOWED_VIEW    = 8;
  196.  
  197.     public const uint INSERTIONPOINTID_PRIMARY_TOP    = 0xa0000000;
  198.     public const uint INSERTIONPOINTID_PRIMARY_NEW    = 0xa0000001;
  199.     public const uint INSERTIONPOINTID_PRIMARY_TASK    = 0xa0000002;
  200.     public const uint INSERTIONPOINTID_PRIMARY_VIEW    = 0xa0000003;
  201.     public const uint INSERTIONPOINTID_3RDPARTY_NEW    = 0x90000001;
  202.     public const uint INSERTIONPOINTID_3RDPARTY_TASK = 0x90000002;
  203.     public const uint INSERTIONPOINTID_ROOT_MENU     = 0x80000000;
  204. }// class CCM
  205.  
  206. public class MMCN
  207. {
  208.     public const uint ACTIVATE           = 0x8001;                        
  209.     public const uint ADD_IMAGES         = 0x8002;                        
  210.     public const uint BTN_CLICK          = 0x8003;                        
  211.     public const uint CLICK              = 0x8004;   // NOT USED          
  212.     public const uint COLUMN_CLICK       = 0x8005;                        
  213.     public const uint CONTEXTMENU        = 0x8006;   // NOT USED          
  214.     public const uint CUTORMOVE          = 0x8007;                       
  215.     public const uint DBLCLICK           = 0x8008;                       
  216.     public const uint DELETE             = 0x8009;                        
  217.     public const uint DESELECT_ALL       = 0x800A;                        
  218.     public const uint EXPAND             = 0x800B;                        
  219.     public const uint HELP               = 0x800C;   // NOT USED          
  220.     public const uint MENU_BTNCLICK      = 0x800D;                        
  221.     public const uint MINIMIZED          = 0x800E;                        
  222.     public const uint PASTE              = 0x800F;                        
  223.     public const uint PROPERTY_CHANGE    = 0x8010;                        
  224.     public const uint QUERY_PASTE        = 0x8011;                        
  225.     public const uint REFRESH            = 0x8012;                        
  226.     public const uint REMOVE_CHILDREN    = 0x8013;                        
  227.     public const uint RENAME             = 0x8014;                        
  228.     public const uint SELECT             = 0x8015;                        
  229.     public const uint SHOW               = 0x8016;                        
  230.     public const uint VIEW_CHANGE        = 0x8017;                        
  231.     public const uint SNAPINHELP         = 0x8018;                        
  232.     public const uint CONTEXTHELP        = 0x8019;                        
  233.     public const uint INITOCX            = 0x801A;                        
  234.     public const uint FILTER_CHANGE      = 0x801B;                        
  235.     public const uint FILTERBTN_CLICK    = 0x801C;                        
  236.     public const uint RESTORE_VIEW       = 0x801D;                        
  237.     public const uint PRINT              = 0x801E;                        
  238.     public const uint PRELOAD            = 0x801F;                        
  239.     public const uint LISTPAD            = 0x8020;                        
  240.     public const uint EXPANDSYNC         = 0x8021;                        
  241.     public const uint COLUMNS_CHANGED    = 0x8022;
  242. }// class MMCN
  243.  
  244. public class SDI
  245. {
  246.     public const uint STR                = 0x2;
  247.     public const uint IMAGE              = 0x4;
  248.     public const uint OPENIMAGE             = 0x8;
  249.     public const uint STATE                 = 0x10;
  250.     public const uint PARAM              = 0x20;
  251.     public const uint CHILDREN             = 0x40;
  252.     public const uint PARENT             = 0;
  253.     public const uint PREVIOUS             = 0x10000000;
  254.     public const uint NEXT                 = 0x20000000;
  255.     public const uint FIRST                 = 0x8000000;
  256. }// class SDI
  257.  
  258. public class RDI
  259. {
  260.     public const uint STR                = 0x2;
  261.     public const uint IMAGE                 = 0x4;
  262.     public const uint STATE                 = 0x8;
  263.     public const uint PARAM                 = 0x10;
  264.     public const uint INDEX                 = 0x20;
  265.     public const uint INDENT             = 0x40;
  266. }// class RDI
  267.  
  268.  
  269. //-------------------------------------------\\
  270. //          Structure Definitions            \\
  271. //-------------------------------------------\\
  272.  
  273. //----------------------------------------------------------------------
  274. // Notes about structures in general
  275. //
  276. // Each structure has the property
  277. // "[StructLayout(LayoutKind.Sequential)]"
  278. //
  279. // This tells C# to pack the structure in sequential memory so it
  280. // can be sent to unmanaged code correctly.
  281. //
  282. // Also, each string is represented by an int. MMC takes care of
  283. // deallocating all the strings we pass it, and it deallocates them
  284. // using CoTaskMemFree, so we must allocate all the strings with
  285. // CoTaskMemCreate. Marshal.StringToCoTaskMemXXX does this for us.
  286. //----------------------------------------------------------------------
  287.  
  288. [StructLayout(LayoutKind.Sequential)]
  289. public struct MMCBUTTON
  290. {
  291.     public int nBitmap;
  292.     public int idCommand;
  293.     public byte fsState;
  294.     public byte fsType;
  295.     public int lpButtonText;
  296.     public int lpTooltipText;
  297. }// struct MMCBUTTON
  298.  
  299. [StructLayout(LayoutKind.Sequential)]
  300. public struct CONTEXTMENUITEM
  301. {
  302.     public int      strName;
  303.     public int      strStatusBarText;
  304.     public int      lCommandID;
  305.     public uint     lInsertionPointID;
  306.     public int      fFlags;
  307.     public int      fSpecialFlags;
  308. }// CONTEXTMENUITEM
  309.  
  310. [StructLayout(LayoutKind.Sequential)]
  311. public struct SCOPEDATAITEM
  312. {
  313.     public uint  mask;
  314.     public int displayname;
  315.     public int  nImage;
  316.     public int  nOpenImage;
  317.     public uint nState;
  318.     public int  cChildren;
  319.     public int  lParam;
  320.     public int relativeID;
  321.     public int ID;
  322. }// struct SCOPEDATAITEM
  323.  
  324. [StructLayout(LayoutKind.Sequential)]
  325. public struct RESULTDATAITEM
  326. {
  327.     public uint mask;
  328.     public int bScopeItem;
  329.     public int itemID;
  330.     public int nIndex;
  331.     public int nCol;
  332.     public int str;
  333.     public int nImage;
  334.     public uint nState;
  335.     public int lParam;
  336.     public int iIndent;
  337. }// struct RESULTDATAITEM
  338.  
  339. //--------------------------------------------------
  340. // These structures are non-MMC specific
  341. //--------------------------------------------------
  342.  
  343. [StructLayout(LayoutKind.Sequential)]
  344. public struct CLSID
  345. {
  346.     public uint x;
  347.     public ushort s1;
  348.     public ushort s2;
  349.     public byte[] c;
  350. }// struct CLSID
  351.  
  352. [StructLayout(LayoutKind.Sequential)]
  353. public struct FORMATETC
  354. {
  355.     public int cfFormat;
  356.     public int ptd;
  357.     public uint dwAspect;
  358.     public int  lindex;
  359.     public uint tymed;
  360. }// struct FORMATETC
  361.  
  362. public delegate int DialogProc(int hwndDlg, uint uMsg, int wParam, int lParam); 
  363. public delegate uint PropSheetPageProc(int hwnd, uint uMsg, int lParam);
  364.  
  365. [StructLayout(LayoutKind.Sequential)]
  366. public struct PROPSHEETPAGE
  367. {  
  368.     public uint            dwSize; 
  369.     public uint            dwFlags; 
  370.     public int             hInstance; 
  371.  
  372.     // This is a union of the following Data items
  373.     // String          pszTemplate; 
  374.     // int             pResource;
  375.  
  376.     public String          pszTemplate;
  377.  
  378.     // This is a union of the following Data items
  379.     // int             hIcon; 
  380.     // String          pszIcon; 
  381.  
  382.     public int             hIcon;
  383.  
  384.     public String          pszTitle; 
  385.  
  386.     // This field should be a delegate, but since we
  387.     // don't support marshalling of delegates in structures,
  388.     // it's just a dummy placeholder
  389.     public int             pfnDlgProc;
  390.     public int             lParam; 
  391.  
  392.     // This field should be a delegate, but since we
  393.     // don't support marshalling of delegates in structures,
  394.     // it's just a dummy placeholder
  395.     public int             pfnCallback;
  396.     public int             pcRefParent; 
  397.  
  398.     public int             pszHeaderTitle;
  399.     public int             pszHeaderSubTitle;
  400. }// struct PROPSHEETPAGE
  401.  
  402.  
  403. //--------------------------------------------------
  404. // This structure is nowhere close to the generalized
  405. // structure used throughout Windows, but it should
  406. // suffice for MMC snapins
  407. //--------------------------------------------------
  408. [StructLayout(LayoutKind.Sequential)]
  409. public struct STGMEDIUM
  410. {
  411.   public uint tymed;
  412.   public int hGlobal;
  413.   public Object pUnkForRelease;
  414. }// struct STGMEDIUM
  415.  
  416. //----------------------------------------------------
  417. // These structure is not used by MMC Snapins.... 
  418. // They are included only to be able to accurately
  419. // define certain interfaces
  420. //----------------------------------------------------
  421. [StructLayout(LayoutKind.Sequential)]
  422. public struct STATSTG
  423. {
  424.     public int pwcsName;
  425.     public uint type;
  426.     public ulong cbSize;
  427.     public FILETIME mtime;
  428.     public FILETIME ctime;
  429.     public FILETIME atime;
  430.     public uint grfMode;
  431.     public uint grfLocksSupported;
  432.     public CLSID clsid;
  433.     public uint grfStateBits;
  434.     public uint reserved;
  435. }// struct STATSTG
  436.  
  437. [StructLayout(LayoutKind.Sequential)]
  438. public struct FILETIME
  439. {
  440.     public uint dwLowDateTime;
  441.     public uint dwHighDateTime;
  442. }// struct FILETIME
  443.  
  444. [StructLayout(LayoutKind.Sequential)]
  445. public struct userFLAG_STGMEDIUM
  446. {
  447.     public int ContextFlags;
  448.     public int fPassOwnership;
  449.     public STGMEDIUM Stgmed;
  450. }// struct userFLAG_STGMEDIUM
  451.  
  452. [StructLayout(LayoutKind.Sequential)]
  453. public struct NMHDR
  454. {
  455.     public int hwndFrom; 
  456.     public uint idFrom; 
  457.     public uint code; 
  458. }// struct NMHDR
  459.  
  460.  
  461.  
  462. }// namespace Microsoft.SampleMMC
  463.  
  464.