home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------------
- // mmcEnumsAndStructs.cs
- //
- // Contains enumerations, constants, and structure definitions used
- // by an MMC snapin
- //
- // NOTE: This is not an all-encompasing list of every enumeration
- // and structure defination available to a snapin... just those used
- // by this snapin.
- //-------------------------------------------------------------
-
- using System;
- using System.Runtime.InteropServices;
-
- namespace Microsoft.SampleMMC
- {
- //-------------------------------------------\\
- // Enums and Constants \\
- //-------------------------------------------\\
-
- public class MMCLV
- {
- public const int AUTO = -1;
- }// class MMCLV
-
- public class LVCFMT
- {
- public const int LEFT = 0x0000;
- public const int RIGHT = 0x0001;
- public const int CENTER = 0x0002;
- public const int JUSTIFYMASK = 0x0003;
- public const int IMAGE = 0x0800;
- public const int BITMAP_ON_RIGHT = 0x1000;
- public const int COL_HAS_IMAGES = 0x8000;
- }// class LVCFMT
-
- public class TBSTATE
- {
- public const byte CHECKED = 0x01;
- public const byte PRESSED = 0x02;
- public const byte ENABLED = 0x04;
- public const byte HIDDEN = 0x08;
- public const byte INDETERMINATE = 0x10;
- public const byte WRAP = 0x20;
- public const byte ELLIPSES = 0x40;
- public const byte MARKED = 0x80;
- }// class TBSTATE
-
- public class TBSTYLE
- {
- public const byte BUTTON = 0x0000;
- public const byte SEP = 0x0001;
- public const byte CHECK = 0x0002;
- public const byte GROUP = 0x0004;
- public const byte CHECKGROUP = (GROUP | CHECK);
- public const byte DROPDOWN = 0x0008;
- public const byte AUTOSIZE = 0x0010;
- public const byte NOPREFIX = 0x0020;
- }// class TBSTYLE
-
- public class EN
- {
- public const uint SETFOCUS = 0x0100;
- public const uint KILLFOCUS = 0x0200;
- public const uint CHANGE = 0x0300;
- public const uint UPDATE = 0x0400;
- public const uint ERRSPACE = 0x0500;
- public const uint MAXTEXT = 0x0501;
- public const uint HSCROLL = 0x0601;
- public const uint VSCROLL = 0x0602;
- }// EN
-
- public class PSM
- {
-
- public const uint SETCURSEL = (0x0400 + 101);
- public const uint REMOVEPAGE = (0x0400 + 102);
- public const uint ADDPAGE = (0x0400 + 103);
- public const uint CHANGED = (0x0400 + 104);
- }// PSM
-
- public class PSN
- {
- public const uint FIRST = unchecked((0U-200U));
- public const uint LAST = unchecked((0U-299U));
- public const uint SETACTIVE = unchecked((FIRST-0));
- public const uint KILLACTIVE = unchecked((FIRST-1));
- public const uint APPLY = unchecked((FIRST-2));
- public const uint RESET = unchecked((FIRST-3));
- public const uint HELP = unchecked((FIRST-5));
- public const uint WIZBACK = unchecked((FIRST-6));
- public const uint WIZNEXT = unchecked((FIRST-7));
- public const uint WIZFINISH = unchecked((FIRST-8));
- public const uint QUERYCANCEL = unchecked((FIRST-9));
- public const uint GETOBJECT = unchecked((FIRST-10));
- }// PSN
-
- // Constants for Window Messages
- public class WM
- {
- public const uint INITDIALOG = 0x0110;
- public const uint COMMAND = 0x0111;
- public const uint DESTROY = 0x0002;
- public const uint NOTIFY = 0x004E;
- }// WM
-
- // Constants required for the Property Sheet Page Callback function
- public class PSPCB
- {
- public const uint ADDREF = 0;
- public const uint RELEASE = 1;
- public const uint CREATE = 2;
- }// PSPCB
-
- public class PSP
- {
- public const uint DEFAULT = 0x00000000;
- public const uint DLGINDIRECT = 0x00000001;
- public const uint USEHICON = 0x00000002;
- public const uint USEICONID = 0x00000004;
- public const uint USETITLE = 0x00000008;
- public const uint RTLREADING = 0x00000010;
-
- public const uint HASHELP = 0x00000020;
- public const uint USEREFPARENT = 0x00000040;
- public const uint USECALLBACK = 0x00000080;
- public const uint PREMATURE = 0x00000400;
-
- public const uint HIDEHEADER = 0x00000800;
- public const uint USEHEADERTITLE = 0x00001000;
- public const uint USEHEADERSUBTITLE = 0x00002000;
- }// class PSP
-
- public class HRESULT
- {
- public const int S_OK = 0;
- public const int S_FALSE = 1;
- public const int E_NOTIMPL = unchecked((int)0x80004001);
- }// HRESULT
-
- public class IMAGE
- {
- public const int BITMAP = 0;
- public const int CURSOR = 1;
- public const int ICON = 2;
- }// class IMAGE_TYPES
-
- public class CCT
- {
- public const uint SCOPE = 0x8000; // Data object for scope pane context
- public const uint RESULT = 0x8001; // Data object for result pane context
- public const uint SNAPIN_MANAGER = 0x8002; // Data object for Snap-in Manager context
- public const uint UNINITIALIZED = 0xFFFF; // Data object has an invalid type
- }// class CCT
-
- public class MMC_BUTTON_STATE
- {
- public const uint ENABLED = 0x1;
- public const uint CHECKED = 0x2;
- public const uint HIDDEN = 0x4;
- public const uint INDETERMINATE = 0x8;
- public const uint BUTTONPRESSED = 0x10;
- }// class MMC_BUTTON_STATE
-
- public class MMC_VERB
- {
- public const uint NONE = 0x0000;
- public const uint OPEN = 0x8000;
- public const uint COPY = 0x8001;
- public const uint PASTE = 0x8002;
- public const uint DELETE = 0x8003;
- public const uint PROPERTIES = 0x8004;
- public const uint RENAME = 0x8005;
- public const uint REFRESH = 0x8006;
- public const uint PRINT = 0x8007;
- public const uint CUT = 0x8008;
-
- public const uint MAX = 0x8009;
- public const uint FIRST = OPEN;
- public const uint LAST = MAX - 1;
- }// class MMC_VERB
-
- public enum MMC_CONTROL_TYPE
- {
- TOOLBAR = 0,
- MENUBUTTON = TOOLBAR + 1,
- COMBOBOXBAR = MENUBUTTON + 1
- }// enum MMC_CONTROL_TYPE
-
- public class CCM
- {
- public const uint INSERTIONALLOWED_TOP = 1;
- public const uint INSERTIONALLOWED_NEW = 2;
- public const uint INSERTIONALLOWED_TASK = 4;
- public const uint INSERTIONALLOWED_VIEW = 8;
-
- public const uint INSERTIONPOINTID_PRIMARY_TOP = 0xa0000000;
- public const uint INSERTIONPOINTID_PRIMARY_NEW = 0xa0000001;
- public const uint INSERTIONPOINTID_PRIMARY_TASK = 0xa0000002;
- public const uint INSERTIONPOINTID_PRIMARY_VIEW = 0xa0000003;
- public const uint INSERTIONPOINTID_3RDPARTY_NEW = 0x90000001;
- public const uint INSERTIONPOINTID_3RDPARTY_TASK = 0x90000002;
- public const uint INSERTIONPOINTID_ROOT_MENU = 0x80000000;
- }// class CCM
-
- public class MMCN
- {
- public const uint ACTIVATE = 0x8001;
- public const uint ADD_IMAGES = 0x8002;
- public const uint BTN_CLICK = 0x8003;
- public const uint CLICK = 0x8004; // NOT USED
- public const uint COLUMN_CLICK = 0x8005;
- public const uint CONTEXTMENU = 0x8006; // NOT USED
- public const uint CUTORMOVE = 0x8007;
- public const uint DBLCLICK = 0x8008;
- public const uint DELETE = 0x8009;
- public const uint DESELECT_ALL = 0x800A;
- public const uint EXPAND = 0x800B;
- public const uint HELP = 0x800C; // NOT USED
- public const uint MENU_BTNCLICK = 0x800D;
- public const uint MINIMIZED = 0x800E;
- public const uint PASTE = 0x800F;
- public const uint PROPERTY_CHANGE = 0x8010;
- public const uint QUERY_PASTE = 0x8011;
- public const uint REFRESH = 0x8012;
- public const uint REMOVE_CHILDREN = 0x8013;
- public const uint RENAME = 0x8014;
- public const uint SELECT = 0x8015;
- public const uint SHOW = 0x8016;
- public const uint VIEW_CHANGE = 0x8017;
- public const uint SNAPINHELP = 0x8018;
- public const uint CONTEXTHELP = 0x8019;
- public const uint INITOCX = 0x801A;
- public const uint FILTER_CHANGE = 0x801B;
- public const uint FILTERBTN_CLICK = 0x801C;
- public const uint RESTORE_VIEW = 0x801D;
- public const uint PRINT = 0x801E;
- public const uint PRELOAD = 0x801F;
- public const uint LISTPAD = 0x8020;
- public const uint EXPANDSYNC = 0x8021;
- public const uint COLUMNS_CHANGED = 0x8022;
- }// class MMCN
-
- public class SDI
- {
- public const uint STR = 0x2;
- public const uint IMAGE = 0x4;
- public const uint OPENIMAGE = 0x8;
- public const uint STATE = 0x10;
- public const uint PARAM = 0x20;
- public const uint CHILDREN = 0x40;
- public const uint PARENT = 0;
- public const uint PREVIOUS = 0x10000000;
- public const uint NEXT = 0x20000000;
- public const uint FIRST = 0x8000000;
- }// class SDI
-
- public class RDI
- {
- public const uint STR = 0x2;
- public const uint IMAGE = 0x4;
- public const uint STATE = 0x8;
- public const uint PARAM = 0x10;
- public const uint INDEX = 0x20;
- public const uint INDENT = 0x40;
- }// class RDI
-
-
- //-------------------------------------------\\
- // Structure Definitions \\
- //-------------------------------------------\\
-
- //----------------------------------------------------------------------
- // Notes about structures in general
- //
- // Each structure has the property
- // "[StructLayout(LayoutKind.Sequential)]"
- //
- // This tells C# to pack the structure in sequential memory so it
- // can be sent to unmanaged code correctly.
- //
- // Also, each string is represented by an int. MMC takes care of
- // deallocating all the strings we pass it, and it deallocates them
- // using CoTaskMemFree, so we must allocate all the strings with
- // CoTaskMemCreate. Marshal.StringToCoTaskMemXXX does this for us.
- //----------------------------------------------------------------------
-
- [StructLayout(LayoutKind.Sequential)]
- public struct MMCBUTTON
- {
- public int nBitmap;
- public int idCommand;
- public byte fsState;
- public byte fsType;
- public int lpButtonText;
- public int lpTooltipText;
- }// struct MMCBUTTON
-
- [StructLayout(LayoutKind.Sequential)]
- public struct CONTEXTMENUITEM
- {
- public int strName;
- public int strStatusBarText;
- public int lCommandID;
- public uint lInsertionPointID;
- public int fFlags;
- public int fSpecialFlags;
- }// CONTEXTMENUITEM
-
- [StructLayout(LayoutKind.Sequential)]
- public struct SCOPEDATAITEM
- {
- public uint mask;
- public int displayname;
- public int nImage;
- public int nOpenImage;
- public uint nState;
- public int cChildren;
- public int lParam;
- public int relativeID;
- public int ID;
- }// struct SCOPEDATAITEM
-
- [StructLayout(LayoutKind.Sequential)]
- public struct RESULTDATAITEM
- {
- public uint mask;
- public int bScopeItem;
- public int itemID;
- public int nIndex;
- public int nCol;
- public int str;
- public int nImage;
- public uint nState;
- public int lParam;
- public int iIndent;
- }// struct RESULTDATAITEM
-
- //--------------------------------------------------
- // These structures are non-MMC specific
- //--------------------------------------------------
-
- [StructLayout(LayoutKind.Sequential)]
- public struct CLSID
- {
- public uint x;
- public ushort s1;
- public ushort s2;
- public byte[] c;
- }// struct CLSID
-
- [StructLayout(LayoutKind.Sequential)]
- public struct FORMATETC
- {
- public int cfFormat;
- public int ptd;
- public uint dwAspect;
- public int lindex;
- public uint tymed;
- }// struct FORMATETC
-
- public delegate int DialogProc(int hwndDlg, uint uMsg, int wParam, int lParam);
- public delegate uint PropSheetPageProc(int hwnd, uint uMsg, int lParam);
-
- [StructLayout(LayoutKind.Sequential)]
- public struct PROPSHEETPAGE
- {
- public uint dwSize;
- public uint dwFlags;
- public int hInstance;
-
- // This is a union of the following Data items
- // String pszTemplate;
- // int pResource;
-
- public String pszTemplate;
-
- // This is a union of the following Data items
- // int hIcon;
- // String pszIcon;
-
- public int hIcon;
-
- public String pszTitle;
-
- // This field should be a delegate, but since we
- // don't support marshalling of delegates in structures,
- // it's just a dummy placeholder
- public int pfnDlgProc;
- public int lParam;
-
- // This field should be a delegate, but since we
- // don't support marshalling of delegates in structures,
- // it's just a dummy placeholder
- public int pfnCallback;
- public int pcRefParent;
-
- public int pszHeaderTitle;
- public int pszHeaderSubTitle;
- }// struct PROPSHEETPAGE
-
-
- //--------------------------------------------------
- // This structure is nowhere close to the generalized
- // structure used throughout Windows, but it should
- // suffice for MMC snapins
- //--------------------------------------------------
- [StructLayout(LayoutKind.Sequential)]
- public struct STGMEDIUM
- {
- public uint tymed;
- public int hGlobal;
- public Object pUnkForRelease;
- }// struct STGMEDIUM
-
- //----------------------------------------------------
- // These structure is not used by MMC Snapins....
- // They are included only to be able to accurately
- // define certain interfaces
- //----------------------------------------------------
- [StructLayout(LayoutKind.Sequential)]
- public struct STATSTG
- {
- public int pwcsName;
- public uint type;
- public ulong cbSize;
- public FILETIME mtime;
- public FILETIME ctime;
- public FILETIME atime;
- public uint grfMode;
- public uint grfLocksSupported;
- public CLSID clsid;
- public uint grfStateBits;
- public uint reserved;
- }// struct STATSTG
-
- [StructLayout(LayoutKind.Sequential)]
- public struct FILETIME
- {
- public uint dwLowDateTime;
- public uint dwHighDateTime;
- }// struct FILETIME
-
- [StructLayout(LayoutKind.Sequential)]
- public struct userFLAG_STGMEDIUM
- {
- public int ContextFlags;
- public int fPassOwnership;
- public STGMEDIUM Stgmed;
- }// struct userFLAG_STGMEDIUM
-
- [StructLayout(LayoutKind.Sequential)]
- public struct NMHDR
- {
- public int hwndFrom;
- public uint idFrom;
- public uint code;
- }// struct NMHDR
-
-
-
- }// namespace Microsoft.SampleMMC
-
-