mapidefs.pas

来自「Drag files and Drop to delphi forms 0402」· PAS 代码 · 共 2,456 行 · 第 1/5 页

PAS
2,456
字号

{ GetLastError }

{***** MAPI_UNICODE            ((ULONG) 0x80000000) above }

(*
 *  Version:
 *)
  
const
  MAPI_ERROR_VERSION = $00000000;
  
  { GetPropList }
  
  {***** MAPI_UNICODE            ((ULONG) 0x80000000) above }
  
  { GetProps }
  
  {***** MAPI_UNICODE            ((ULONG) 0x80000000) above }
  
  { SaveChanges }
  
  KEEP_OPEN_READONLY = ULONG($00000001);
  KEEP_OPEN_READWRITE = ULONG($00000002);
  FORCE_SAVE = ULONG($00000004);
  
  { define MAPI_DEFERRED_ERRORS  ((ULONG) 0x00000008) below }
  
  { OpenProperty  - ulFlags }
  
  {***** MAPI_MODIFY             ((ULONG) 0x00000001) above }
  
  MAPI_CREATE = ULONG($00000002);
  STREAM_APPEND = ULONG($00000004);
  
  {***** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below }
  
  { OpenProperty  - ulInterfaceOptions, IID_IMAPITable }
  
  {***** MAPI_UNICODE            ((ULONG) 0x80000000) above }
  
  { CopyTo, CopyProps }
  
  MAPI_MOVE = ULONG($00000001);
  MAPI_NOREPLACE = ULONG($00000002);
  MAPI_DECLINE_OK = ULONG($00000004);
  
                                       { also defined in mapi.h }
  MAPI_DIALOG = ULONG($00000008);

                                       { also defined in mapi.h }
  MAPI_USE_DEFAULT = $00000040         { Use default profile in logon }
  ;

  { Flags used in GetIDsFromNames  }
  
  {***** MAPI_CREATE             ((ULONG) 0x00000002) above }
  
  { Flags used in GetNamesFromIDs  (bit fields) }
  
  MAPI_NO_STRINGS = ULONG($00000001);
  MAPI_NO_IDS = ULONG($00000002);
  
  {  Union discriminator  }
  
  MNID_ID = 0;
  MNID_STRING = 1;

type
  TMAPINAMEID =     
    record
      lpguid : PGUID;
      ulKind : ULONG;
      Kind :         
        record
          case Integer of
            1 : 
              (
                lID : Longint;
              );
            2 : 
              (
                lpwstrName : PWSTR;
              );
      end;
    end;
    
  PMAPINAMEID = ^TMAPINAMEID;
  
  { Interface used for registering and issuing notification callbacks. }
  IMAPIAdviseSink =
    interface(IUnknown)
    [strIID_IMAPIAdviseSink]
      function OnNotify (cNotif : ULONG; lpNotifications : PNOTIFICATION) : ULONG; stdcall;
    end;

  IMAPIProgress =
    interface(IUnknown)
    [strIID_IMAPIProgress]
      function Progress (ulValue : ULONG; ulCount : ULONG; ulTotal : ULONG) : HResult; stdcall;
      function GetFlags (var lpulFlags : ULONG) : HResult; stdcall;
      function GetMax (var lpulMax : ULONG) : HResult; stdcall;
      function GetMin (var lpulMin : ULONG) : HResult; stdcall;
      function SetLimits (lpulMin : PULONG; lpulMax : PULONG; lpulFlags : PULONG) : HResult; stdcall;
    end;

  IMAPIProp =
    interface(IUnknown)
    [strIID_IMAPIProp]
      function GetLastError (hResult : HResult; ulFlags : ULONG;
        var lppMAPIError : PMAPIERROR) : HResult; stdcall;
      function SaveChanges (ulFlags : ULONG) : HResult; stdcall;
      function GetProps (lpPropTagArray : PSPropTagArray; ulFlags : ULONG; 
        var lpcValues : ULONG;
        var lppPropArray : PSPropValue) : HResult; stdcall;
      function GetPropList (ulFlags : ULONG;
        var lppPropTagArray : PSPropTagArray) : HResult; stdcall;
      function OpenProperty (ulPropTag : ULONG; const lpiid : TIID; 
        ulInterfaceOptions : ULONG; ulFlags : ULONG;
        var lppUnk : IUnknown) : HResult; stdcall;
      function SetProps (cValues : ULONG; lpPropArray : PSPropValue; 
        var lppProblems : PSPropProblemArray) : HResult; stdcall;
      function DeleteProps (lpPropTagArray : PSPropTagArray; 
        var lppProblems : PSPropProblemArray) : HResult; stdcall;
      function CopyTo (ciidExclude : ULONG; const rgiidExclude : TIID; 
        lpExcludeProps : PSPropTagArray; ulUIParam : ULONG; 
        lpProgress : IMAPIProgress; const lpInterface : TIID;
        lpDestObj : Pointer; ulFlags : ULONG;
        var lppProblems : PSPropProblemArray) : HResult; stdcall;
      function CopyProps (lpIncludeProps : PSPropTagArray; ulUIParam : ULONG; 
        lpProgress : IMAPIProgress; const lpInterface : TIID; lpDestObj : Pointer; 
        ulFlags : ULONG; var lppProblems : PSPropProblemArray) : HResult; stdcall;
      function GetNamesFromIDs (var lppPropTags : PSPropTagArray; 
        lpPropSetGuid : PGUID; ulFlags : ULONG; var lpcPropNames : ULONG; 
        var lpppPropNames : PMAPINAMEID) : HResult; stdcall;
      function GetIDsFromNames (cPropNames : ULONG; var lppPropNames : PMAPINAMEID; 
        ulFlags : ULONG; var lppPropTags : PSPropTagArray) : HResult; stdcall;
    end;
  
{ IMAPITable Interface ---------------------------------------------------- }

{ Table status }
  
const
  TBLSTAT_COMPLETE = ULONG(0);
  TBLSTAT_QCHANGED = ULONG(7);
  TBLSTAT_SORTING = ULONG(9);
  TBLSTAT_SORT_ERROR = ULONG(10);
  TBLSTAT_SETTING_COLS = ULONG(11);
  TBLSTAT_SETCOL_ERROR = ULONG(13);
  TBLSTAT_RESTRICTING = ULONG(14);
  TBLSTAT_RESTRICT_ERROR = ULONG(15);
  
  { Table Type }
  
  TBLTYPE_SNAPSHOT = ULONG(0);
  TBLTYPE_KEYSET = ULONG(1);
  TBLTYPE_DYNAMIC = ULONG(2);
  
  { Sort order }
  
  { bit 0: set if descending, clear if ascending }
  
  TABLE_SORT_ASCEND = ULONG($00000000);
  TABLE_SORT_DESCEND = ULONG($00000001);
  TABLE_SORT_COMBINE = ULONG($00000002);
  
  { Data structures }
  
type
  TSSortOrder =     
    record
      ulPropTag : ULONG;               { Column to sort on }
      ulOrder : ULONG;                 { Ascending, descending, combine to left }
    end;
    
  PSSortOrder = ^TSSortOrder;
  
  TSSortOrderSet =     
    record
      cSorts : ULONG;                  { Number of sort columns in aSort below}
      cCategories : ULONG;             { 0 for non-categorized, up to cSorts }
      cExpanded : ULONG;               { 0 if no categories start expanded, }
                                       {      up to cExpanded }
      aSort : array[0..MAPI_DIM - 1] of TSSortOrder;
                                       { The sort orders }
    end;
    
  PSSortOrderSet = ^TSSortOrderSet;
  
type
  TBOOKMARK = ULONG;
  
const
  BOOKMARK_BEGINNING = TBOOKMARK(0)    { Before first row }
  ;
  BOOKMARK_CURRENT = TBOOKMARK(1)      { Before current row }
  ;
  BOOKMARK_END = TBOOKMARK(2)          { After last row }
  ;

{ Fuzzy Level }

const
  FL_FULLSTRING = ULONG($00000000);
  FL_SUBSTRING = ULONG($00000001);
  FL_PREFIX = ULONG($00000002);
  FL_IGNORECASE = ULONG($00010000);
  FL_IGNORENONSPACE = ULONG($00020000);
  FL_LOOSE = ULONG($00040000);

{ Restriction types }

const
  RES_AND = ULONG($00000000);
  RES_OR = ULONG($00000001);
  RES_NOT = ULONG($00000002);
  RES_CONTENT = ULONG($00000003);
  RES_PROPERTY = ULONG($00000004);
  RES_COMPAREPROPS = ULONG($00000005);
  RES_BITMASK = ULONG($00000006);
  RES_SIZE = ULONG($00000007);
  RES_EXIST = ULONG($00000008);
  RES_SUBRESTRICTION = ULONG($00000009);
  RES_COMMENT = ULONG($0000000A);

{ Relational operators. These apply to all property comparison restrictions. }

const
  RELOP_LT = ULONG(0)                  { <  }
  ;
  RELOP_LE = ULONG(1)                  { <= }
  ;
  RELOP_GT = ULONG(2)                  { >  }
  ;
  RELOP_GE = ULONG(3)                  { >= }
  ;
  RELOP_EQ = ULONG(4)                  { == }
  ;
  RELOP_NE = ULONG(5)                  { != }
  ;
  RELOP_RE = ULONG(6)                  { LIKE (Regular expression) }
  ;

{ Bitmask operators, for RES_BITMASK only. }

const
  BMR_EQZ = ULONG(0)                   { ==0 }
  ;
  BMR_NEZ = ULONG(1)                   { !=0 }
  ;

{ Subobject identifiers for RES_SUBRESTRICTION only. See MAPITAGS.H. }

{ #define PR_MESSAGE_RECIPIENTS  PROP_TAG(PT_OBJECT,0x0E12) }

{ #define PR_MESSAGE_ATTACHMENTS PROP_TAG(PT_OBJECT,0x0E13) }

{ Restrictions }

type
  PSRestriction = ^TSRestriction;

  TSAndRestriction =
    record
      cRes : ULONG;
      lpRes : PSRestriction;
    end;
    
  TSOrRestriction =     
    record
      cRes : ULONG;
      lpRes : PSRestriction;
    end;
    
  TSNotRestriction =     
    record
      ulReserved : ULONG;
      lpRes : PSRestriction;
    end;
    
  TSContentRestriction =     
    record
      ulFuzzyLevel : ULONG;
      ulPropTag : ULONG;
      lpProp : PSPropValue;
    end;
    
  TSBitMaskRestriction =     
    record
      relBMR : ULONG;
      ulPropTag : ULONG;
      ulMask : ULONG;
    end;
    
  TSPropertyRestriction =     
    record
      relop : ULONG;
      ulPropTag : ULONG;
      lpProp : PSPropValue;
    end;
    
  TSComparePropsRestriction =     
    record
      relop : ULONG;
      ulPropTag1 : ULONG;
      ulPropTag2 : ULONG;
    end;
    
  TSSizeRestriction =     
    record
      relop : ULONG;
      ulPropTag : ULONG;
      cb : ULONG;
    end;
    
  TSExistRestriction =     
    record
      ulReserved1 : ULONG;
      ulPropTag : ULONG;
      ulReserved2 : ULONG;
    end;
    
  TSSubRestriction =     
    record
      ulSubObject : ULONG;
      lpRes : PSRestriction;
    end;
    
  TSCommentRestriction =     
    record
      cValues : ULONG;                 { # of properties in lpProp }
      lpRes : PSRestriction;
      lpProp : PSPropValue;
    end;
    
  TSRestriction =
    record
      rt : ULONG;                      { Restriction type }
      res :         
        record
          case Integer of
            1 : 
              (
                resCompareProps : TSComparePropsRestriction;
                                       { first }
              );
            2 : 
              (
                resAnd : TSAndRestriction;
              );
            3 : 
              (
                resOr : TSOrRestriction;
              );
            4 : 
              (
                resNot : TSNotRestriction;
              );
            5 : 
              (
                resContent : TSContentRestriction;
              );
            6 : 
              (
                resProperty : TSPropertyRestriction;
              );
            7 : 
              (
                resBitMask : TSBitMaskRestriction;
              );
            8 : 
              (
                resSize : TSSizeRestriction;
              );
            9 : 
              (
                resExist : TSExistRestriction;
              );
            10 : 
              (
                resSub : TSSubRestriction;
              );
            11 : 
              (
                resComment : TSCommentRestriction;
              );
      end;
    end;
    
{ SComparePropsRestriction is first in the union so that }

{ static initializations of 3-value restriction work.    }

{ Flags of the methods of IMAPITable }

{ QueryColumn }

const
  TBL_ALL_COLUMNS = ULONG($00000001);

{ QueryRows }

{ Possible values for PR_ROW_TYPE (for categorization) }

const
  TBL_LEAF_ROW = ULONG(1);
  TBL_EMPTY_CATEGORY = ULONG(2);
  TBL_EXPANDED_CATEGORY = ULONG(3);
  TBL_COLLAPSED_CATEGORY = ULONG(4);

{ Table wait flag }

const
  TBL_NOWAIT = ULONG($00000001);

{ alternative name for TBL_NOWAIT }

const
  TBL_ASYNC = ULONG($00000001);
  TBL_BATCH = ULONG($00000002);

{ FindRow }

const
  DIR_BACKWARD = ULONG($00000001);

{ Table cursor states }

const
  TBL_NOADVANCE = ULONG($00000001);

type
  IMAPITable =
    interface(IUnknown)
    [strIID_IMAPITable]
      function GetLastError (hResult : HResult; ulFlags : ULONG;
        var lppMAPIError : PMAPIERROR) : HResult; stdcall;
      function Advise (ulEventMask : ULONG; lpAdviseSink : IMAPIAdviseSink; 
        var lpulConnection : ULONG) : HResult; stdcall;
      function Unadvise (ulConnection : ULONG) : HResult; stdcall;
      function GetStatus (var lpulTableStatus : ULONG; var lpulTableType : ULONG) : HResult; stdcall;
      function SetColumns (lpPropTagArray : PSPropTagArray; ulFlags : ULONG) : HResult; stdcall;
      function QueryColumns (ulFlags : ULONG; var lpPropTagArray : PSPropTagArray) : HResult; stdcall;
      function GetRowCount (ulFlags : ULONG; var lpulCount : ULONG) : HResult; stdcall;
      function SeekRow (bkOrigin : TBOOKMARK; lRowCount : Longint; 
        var lplRowsSought : Longint) : HResult; stdcall;
      function SeekRowApprox (ulNumerator : ULONG; ulDenominator : ULONG) : HResult; stdcall;
      function QueryPosition (var lpulRow : ULONG; var lpulNumerator : ULONG; 
        var lpulDenominator : ULONG) : HResult; stdcall;
      function FindRow (lpRestriction : PSRestriction; bkOrigin : TBOOKMARK; 
        ulFlags : ULONG) : HResult; stdcall;
      function Restrict (lpRestriction : PSRestriction; ulFlags : ULONG) : HResult; stdcall;
      function CreateBookmark (var lpbkPosition : TBOOKMARK) : HResult; stdcall;
      function FreeBookmark (bkPosition : TBOOKMARK) : HResult; stdcall;
      function SortTable (lpSortCriteria : PSSortOrderSet; ulFlags : ULONG) : HResult; stdcall;
      function QuerySortOrder (var lppSortCriteria : PSSortOrderSet) : HResult; stdcall;
      function QueryRows (lRowCount : Longint; ulFlags : ULONG; 
        var lppRows : PSRowSet) : HResult; stdcall;
      function Abort : HResult; stdcall;
      function ExpandRow (cbInstanceKey : ULONG; pbInstanceKey : PBYTE; 
        ulRowCount : ULONG; ulFlags : ULONG; var lppRows : PSRowSet; 
        var lpulMoreRows : ULONG) : HResult; stdcall;
      function CollapseRow (cbInstanceKey : ULONG; pbInstanceKey : PBYTE; 
        ulFlags : ULONG; var lpulRowCount : ULONG) : HResult; stdcall;
      function WaitForCompletion (ulFlags : ULONG; ulTimeout : ULONG; 
        var lpulTableStatus : ULONG) : HResult; stdcall;
      function GetCollapseState (ulFlags : ULONG; cbInstanceKey : ULONG; 
        lpbInstanceKey : PBYTE; var lpcbCollapseState : ULONG; 
        var lppbCollapseState : PBYTE) : HResult; stdcall;
      function SetCollapseState (ulFlags : ULONG; cbCollapseState : ULONG; 
        pbCollapseState : PBYTE; var lpbkLocation : TBOOKMARK) : HResult; stdcall;
    end;
  
{ IProfSect Interface ----------------------------------------------------- }

{ Standard section for public profile properties }
  
const
  PS_PROFILE_PROPERTIES_INIT : array[0..15] of Integer =
    (
      $98, $15, $AC, $08, $AA, $B0, $10, $1A, $8C, $93, $08, 
      $00, $2, $2A, $56, $C2
    );

type
  IProfSect =
    interface(IMAPIProp)
    [strIID_IProfSect]
    end;

{ IMAPIStatus Interface --------------------------------------------------- }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?