home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1996 August / VPR9608A.BIN / del20try / install / data.z / OLEDLG.PAS < prev    next >
Pascal/Delphi Source File  |  1996-05-08  |  34KB  |  803 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Runtime Library                          }
  5. {       Windows 32bit API Interface Unit                }
  6. {                                                       }
  7. {       Copyright (c) 1996 Borland International        }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit OleDlg;
  12.  
  13. interface
  14.  
  15. uses Windows, CommCtrl, Ole2;
  16.  
  17. const
  18.  
  19. { Help Button Identifier }
  20.  
  21.   IDC_OLEUIHELP                   = 99;
  22.  
  23. { Insert Object Dialog identifiers }
  24.  
  25.   IDC_IO_CREATENEW                = 2100;
  26.   IDC_IO_CREATEFROMFILE           = 2101;
  27.   IDC_IO_LINKFILE                 = 2102;
  28.   IDC_IO_OBJECTTYPELIST           = 2103;
  29.   IDC_IO_DISPLAYASICON            = 2104;
  30.   IDC_IO_CHANGEICON               = 2105;
  31.   IDC_IO_FILE                     = 2106;
  32.   IDC_IO_FILEDISPLAY              = 2107;
  33.   IDC_IO_RESULTIMAGE              = 2108;
  34.   IDC_IO_RESULTTEXT               = 2109;
  35.   IDC_IO_ICONDISPLAY              = 2110;
  36.   IDC_IO_OBJECTTYPETEXT           = 2111;
  37.   IDC_IO_FILETEXT                 = 2112;
  38.   IDC_IO_FILETYPE                 = 2113;
  39.   IDC_IO_INSERTCONTROL            = 2114;
  40.   IDC_IO_ADDCONTROL               = 2115;
  41.   IDC_IO_CONTROLTYPELIST          = 2116;
  42.  
  43. { Paste Special Dialog identifiers }
  44.  
  45.   IDC_PS_PASTE                    = 500;
  46.   IDC_PS_PASTELINK                = 501;
  47.   IDC_PS_SOURCETEXT               = 502;
  48.   IDC_PS_PASTELIST                = 503;
  49.   IDC_PS_PASTELINKLIST            = 504;
  50.   IDC_PS_DISPLAYLIST              = 505;
  51.   IDC_PS_DISPLAYASICON            = 506;
  52.   IDC_PS_ICONDISPLAY              = 507;
  53.   IDC_PS_CHANGEICON               = 508;
  54.   IDC_PS_RESULTIMAGE              = 509;
  55.   IDC_PS_RESULTTEXT               = 510;
  56.  
  57. { Change Icon Dialog identifiers }
  58.  
  59.   IDC_CI_GROUP                    = 120;
  60.   IDC_CI_CURRENT                  = 121;
  61.   IDC_CI_CURRENTICON              = 122;
  62.   IDC_CI_DEFAULT                  = 123;
  63.   IDC_CI_DEFAULTICON              = 124;
  64.   IDC_CI_FROMFILE                 = 125;
  65.   IDC_CI_FROMFILEEDIT             = 126;
  66.   IDC_CI_ICONLIST                 = 127;
  67.   IDC_CI_LABEL                    = 128;
  68.   IDC_CI_LABELEDIT                = 129;
  69.   IDC_CI_BROWSE                   = 130;
  70.   IDC_CI_ICONDISPLAY              = 131;
  71.  
  72. { Convert Dialog identifiers }
  73.  
  74.   IDC_CV_OBJECTTYPE               = 150;
  75.   IDC_CV_DISPLAYASICON            = 152;
  76.   IDC_CV_CHANGEICON               = 153;
  77.   IDC_CV_ACTIVATELIST             = 154;
  78.   IDC_CV_CONVERTTO                = 155;
  79.   IDC_CV_ACTIVATEAS               = 156;
  80.   IDC_CV_RESULTTEXT               = 157;
  81.   IDC_CV_CONVERTLIST              = 158;
  82.   IDC_CV_ICONDISPLAY              = 165;
  83.  
  84. { Edit Links Dialog identifiers }
  85.  
  86.   IDC_EL_CHANGESOURCE             = 201;
  87.   IDC_EL_AUTOMATIC                = 202;
  88.   IDC_EL_CANCELLINK               = 209;
  89.   IDC_EL_UPDATENOW                = 210;
  90.   IDC_EL_OPENSOURCE               = 211;
  91.   IDC_EL_MANUAL                   = 212;
  92.   IDC_EL_LINKSOURCE               = 216;
  93.   IDC_EL_LINKTYPE                 = 217;
  94.   IDC_EL_LINKSLISTBOX             = 206;
  95.   IDC_EL_COL1                     = 220;
  96.   IDC_EL_COL2                     = 221;
  97.   IDC_EL_COL3                     = 222;
  98.  
  99. { Busy dialog identifiers }
  100.  
  101.   IDC_BZ_RETRY                    = 600;
  102.   IDC_BZ_ICON                     = 601;
  103.   IDC_BZ_MESSAGE1                 = 602;
  104.   IDC_BZ_SWITCHTO                 = 604;
  105.  
  106. { Update Links dialog identifiers }
  107.  
  108.   IDC_UL_METER                    = 1029;
  109.   IDC_UL_STOP                     = 1030;
  110.   IDC_UL_PERCENT                  = 1031;
  111.   IDC_UL_PROGRESS                 = 1032;
  112.  
  113. { User Prompt dialog identifiers }
  114.  
  115.   IDC_PU_LINKS                    = 900;
  116.   IDC_PU_TEXT                     = 901;
  117.   IDC_PU_CONVERT                  = 902;
  118.   IDC_PU_ICON                     = 908;
  119.  
  120. { General Properties identifiers }
  121.  
  122.   IDC_GP_OBJECTNAME               = 1009;
  123.   IDC_GP_OBJECTTYPE               = 1010;
  124.   IDC_GP_OBJECTSIZE               = 1011;
  125.   IDC_GP_CONVERT                  = 1013;
  126.   IDC_GP_OBJECTICON               = 1014;
  127.   IDC_GP_OBJECTLOCATION           = 1022;
  128.  
  129. { View Properties identifiers }
  130.  
  131.   IDC_VP_PERCENT                  = 1000;
  132.   IDC_VP_CHANGEICON               = 1001;
  133.   IDC_VP_EDITABLE                 = 1002;
  134.   IDC_VP_ASICON                   = 1003;
  135.   IDC_VP_RELATIVE                 = 1005;
  136.   IDC_VP_SPIN                     = 1006;
  137.   IDC_VP_SCALETXT                 = 1034;
  138.   IDC_VP_ICONDISPLAY              = 1021;
  139.   IDC_VP_RESULTIMAGE              = 1033;
  140.  
  141. { Link Properties identifiers }
  142.  
  143.   IDC_LP_OPENSOURCE               = 1006;
  144.   IDC_LP_UPDATENOW                = 1007;
  145.   IDC_LP_BREAKLINK                = 1008;
  146.   IDC_LP_LINKSOURCE               = 1012;
  147.   IDC_LP_CHANGESOURCE             = 1015;
  148.   IDC_LP_AUTOMATIC                = 1016;
  149.   IDC_LP_MANUAL                   = 1017;
  150.   IDC_LP_DATE                     = 1018;
  151.   IDC_LP_TIME                     = 1019;
  152.  
  153. { Dialog Identifiers as passed in Help messages to identify the source }
  154.  
  155.   IDD_INSERTOBJECT                = 1000;
  156.   IDD_CHANGEICON                  = 1001;
  157.   IDD_CONVERT                     = 1002;
  158.   IDD_PASTESPECIAL                = 1003;
  159.   IDD_EDITLINKS                   = 1004;
  160.   IDD_BUSY                        = 1006;
  161.   IDD_UPDATELINKS                 = 1007;
  162.   IDD_CHANGESOURCE                = 1009;
  163.   IDD_INSERTFILEBROWSE            = 1010;
  164.   IDD_CHANGEICONBROWSE            = 1011;
  165.   IDD_CONVERTONLY                 = 1012;
  166.   IDD_CHANGESOURCE4               = 1013;
  167.   IDD_GNRLPROPS                   = 1100;
  168.   IDD_VIEWPROPS                   = 1101;
  169.   IDD_LINKPROPS                   = 1102;
  170.  
  171. { The following Dialogs are message dialogs used by OleUIPromptUser API }
  172.  
  173.   IDD_CANNOTUPDATELINK            = 1008;
  174.   IDD_LINKSOURCEUNAVAILABLE       = 1020;
  175.   IDD_SERVERNOTFOUND              = 1023;
  176.   IDD_OUTOFMEMORY                 = 1024;
  177.   IDD_SERVERNOTREG                = 1021;
  178.   IDD_LINKTYPECHANGED             = 1022;
  179.  
  180. { Delimeter used to separate ItemMoniker pieces of a composite moniker }
  181.  
  182.   OLESTDDELIM = '\';
  183.  
  184. { Strings for registered messages }
  185.  
  186.   SZOLEUI_MSG_HELP                = 'OLEUI_MSG_HELP';
  187.   SZOLEUI_MSG_ENDDIALOG           = 'OLEUI_MSG_ENDDIALOG';
  188.   SZOLEUI_MSG_BROWSE              = 'OLEUI_MSG_BROWSE';
  189.   SZOLEUI_MSG_CHANGEICON          = 'OLEUI_MSG_CHANGEICON';
  190.   SZOLEUI_MSG_CLOSEBUSYDIALOG     = 'OLEUI_MSG_CLOSEBUSYDIALOG';
  191.   SZOLEUI_MSG_CONVERT             = 'OLEUI_MSG_CONVERT';
  192.   SZOLEUI_MSG_CHANGESOURCE        = 'OLEUI_MSG_CHANGESOURCE';
  193.   SZOLEUI_MSG_ADDCONTROL          = 'OLEUI_MSG_ADDCONTROL';
  194.   SZOLEUI_MSG_BROWSE_OFN          = 'OLEUI_MSG_BROWSE_OFN';
  195.  
  196. { Identifiers for SZOLEUI_MSG_BROWSE_OFN (in wParam) }
  197.  
  198.   ID_BROWSE_CHANGEICON            = 1;
  199.   ID_BROWSE_INSERTFILE            = 2;
  200.   ID_BROWSE_ADDCONTROL            = 3;
  201.   ID_BROWSE_CHANGESOURCE          = 4;
  202.  
  203. { Standard success/error definitions }
  204.  
  205.   OLEUI_FALSE                     = 0;
  206.   OLEUI_SUCCESS                   = 1;   { No error, same as OLEUI_OK }
  207.   OLEUI_OK                        = 1;   { OK button pressed }
  208.   OLEUI_CANCEL                    = 2;   { Cancel button pressed }
  209.  
  210.   OLEUI_ERR_STANDARDMIN           = 100;
  211.   OLEUI_ERR_STRUCTURENULL         = 101; { Standard field validation }
  212.   OLEUI_ERR_STRUCTUREINVALID      = 102;
  213.   OLEUI_ERR_CBSTRUCTINCORRECT     = 103;
  214.   OLEUI_ERR_HWNDOWNERINVALID      = 104;
  215.   OLEUI_ERR_LPSZCAPTIONINVALID    = 105;
  216.   OLEUI_ERR_LPFNHOOKINVALID       = 106;
  217.   OLEUI_ERR_HINSTANCEINVALID      = 107;
  218.   OLEUI_ERR_LPSZTEMPLATEINVALID   = 108;
  219.   OLEUI_ERR_HRESOURCEINVALID      = 109;
  220.  
  221.   OLEUI_ERR_FINDTEMPLATEFAILURE   = 110; { Initialization errors }
  222.   OLEUI_ERR_LOADTEMPLATEFAILURE   = 111;
  223.   OLEUI_ERR_DIALOGFAILURE         = 112;
  224.   OLEUI_ERR_LOCALMEMALLOC         = 113;
  225.   OLEUI_ERR_GLOBALMEMALLOC        = 114;
  226.   OLEUI_ERR_LOADSTRING            = 115;
  227.   OLEUI_ERR_OLEMEMALLOC           = 116;
  228.  
  229.   OLEUI_ERR_STANDARDMAX           = 117; { Start here for specific errors }
  230.  
  231. { Hook type used in all structures }
  232.  
  233. type
  234.   TFNOleUIHook = function(Wnd: HWnd; Msg, WParam, LParam: Longint): Longint stdcall;
  235.  
  236. { Miscellaneous utility functions }
  237.  
  238. function OleUIAddVerbMenu(oleObj: IOleObject; pszShortType: PChar;
  239.   menu: HMenu; uPos: Integer; uIDVerbMin: Integer; uIDVerbMax: Integer;
  240.   bAddConvert: BOOL; idConvert: Integer; var outMenu: HMenu): BOOL; stdcall;
  241.  
  242. { **** Insert Object dialog **** }
  243.  
  244. { Insert object dialog structure }
  245.  
  246. type
  247.   POleUIInsertObject = ^TOleUIInsertObject;
  248.   TOleUIInsertObject = record
  249.     cbStruct: Longint;                  { Structure Size }
  250.     dwFlags: Longint;                   { IN-OUT: Flags }
  251.     hWndOwner: HWnd;                    { Owning window }
  252.     lpszCaption: PChar;                 { Dialog caption bar contents }
  253.     lpfnHook: TFNOleUIHook;             { Hook callback }
  254.     lCustData: Longint;                 { Custom data to pass to hook }
  255.     hInstance: THandle;                 { Instance for customized template name }
  256.     lpszTemplate: PChar;                { Customized template name }
  257.     hResource: HRsrc;                   { Customized template handle }
  258.     clsid: TCLSID;                      { OUT: Return space for class ID }
  259.     lpszFile: PChar;                    { IN-OUT: Filename for inserts or links }
  260.     cchFile: Integer;                   { IN: Size of lpszFile buffer: MAX_PATH }
  261.     cClsidExclude: Integer;             { IN: CLSIDs in lpClsidExclude }
  262.     lpClsidExclude: PCLSID;             { IN: List of CLSIDs to exclude from listing }
  263.     iid: TIID;                          { IN: Requested interface on creation }
  264.     oleRender: Longint;                 { IN: Rendering option }
  265.     lpFormatEtc: PFormatEtc;            { IN: Desired format }
  266.     lpIOleClientSite: IOleClientSite;   { IN: Site to be use for the object }
  267.     lpIStorage: IStorage;               { IN: Storage used for the object }
  268.     ppvObj: Pointer;                    { OUT: Where the object is returned }
  269.     sc: HResult;                        { OUT: Result of creation calls }
  270.     hMetaPict: HGlobal;                 { OUT: metafile aspect (METAFILEPICT) }
  271.   end;
  272.  
  273. { Insert object dialog function }
  274.  
  275. function OleUIInsertObject(var Info: TOleUIInsertObject): Integer; stdcall;
  276.  
  277. { Insert Object flags }
  278.  
  279. const
  280.   IOF_SHOWHELP                    = $00000001;
  281.   IOF_SELECTCREATENEW             = $00000002;
  282.   IOF_SELECTCREATEFROMFILE        = $00000004;
  283.   IOF_CHECKLINK                   = $00000008;
  284.   IOF_CHECKDISPLAYASICON          = $00000010;
  285.   IOF_CREATENEWOBJECT             = $00000020;
  286.   IOF_CREATEFILEOBJECT            = $00000040;
  287.   IOF_CREATELINKOBJECT            = $00000080;
  288.   IOF_DISABLELINK                 = $00000100;
  289.   IOF_VERIFYSERVERSEXIST          = $00000200;
  290.   IOF_DISABLEDISPLAYASICON        = $00000400;
  291.   IOF_HIDECHANGEICON              = $00000800;
  292.   IOF_SHOWINSERTCONTROL           = $00001000;
  293.   IOF_SELECTCREATECONTROL         = $00002000;
  294.  
  295. { Insert Object specific error codes }
  296.  
  297. const
  298.   OLEUI_IOERR_LPSZFILEINVALID         = OLEUI_ERR_STANDARDMAX + 0;
  299.   OLEUI_IOERR_LPSZLABELINVALID        = OLEUI_ERR_STANDARDMAX + 1;
  300.   OLEUI_IOERR_HICONINVALID            = OLEUI_ERR_STANDARDMAX + 2;
  301.   OLEUI_IOERR_LPFORMATETCINVALID      = OLEUI_ERR_STANDARDMAX + 3;
  302.   OLEUI_IOERR_PPVOBJINVALID           = OLEUI_ERR_STANDARDMAX + 4;
  303.   OLEUI_IOERR_LPIOLECLIENTSITEINVALID = OLEUI_ERR_STANDARDMAX + 5;
  304.   OLEUI_IOERR_LPISTORAGEINVALID       = OLEUI_ERR_STANDARDMAX + 6;
  305.   OLEUI_IOERR_SCODEHASERROR           = OLEUI_ERR_STANDARDMAX + 7;
  306.   OLEUI_IOERR_LPCLSIDEXCLUDEINVALID   = OLEUI_ERR_STANDARDMAX + 8;
  307.   OLEUI_IOERR_CCHFILEINVALID          = OLEUI_ERR_STANDARDMAX + 9;
  308.  
  309. { **** Paste Special dialog **** }
  310.  
  311. { The OLEUIPASTE_xxx values are used by the TOleUIPasteEntry structure.
  312.  
  313.   OLEUIPASTE_ENABLEICON: If the container does not specify this flag for
  314.        the entry in the TOleUIPasteEntry array passed as input to
  315.        OleUIPasteSpecial, the DisplayAsIcon button will be unchecked and
  316.        disabled when the the user selects the format that corresponds to
  317.        the entry.
  318.  
  319.   OLEUIPASTE_PASTEONLY: Indicates that the entry in the TOleUIPasteEntry
  320.        array is valid for pasting only.
  321.  
  322.   OLEUIPASTE_PASTE: Indicates that the entry in the TOleUIPasteEntry array
  323.        is valid for pasting. It may also be valid for linking if any of
  324.        the following linking flags are specified.
  325.  
  326.   If the entry in the TOleUIPasteEntry array is valid for linking, the
  327.   following flags indicate which link types are acceptable by OR'ing
  328.   together the appropriate OLEUIPASTE_LINKTYPE<#> values.
  329.  
  330.   These values correspond as follows to the array of link types passed to
  331.   OleUIPasteSpecial:
  332.  
  333.     OLEUIPASTE_LINKTYPE1 = arrLinkTypes[0]
  334.     OLEUIPASTE_LINKTYPE2 = arrLinkTypes[1]
  335.     OLEUIPASTE_LINKTYPE3 = arrLinkTypes[2]
  336.     OLEUIPASTE_LINKTYPE4 = arrLinkTypes[3]
  337.     OLEUIPASTE_LINKTYPE5 = arrLinkTypes[4]
  338.     OLEUIPASTE_LINKTYPE6 = arrLinkTypes[5]
  339.     OLEUIPASTE_LINKTYPE7 = arrLinkTypes[6]
  340.     OLEUIPASTE_LINKTYPE8 = arrLinkTypes[7]
  341.  
  342.   where,
  343.     UINT arrLinkTypes[8] is an array of registered clipboard formats for
  344.     linking. A maximium of 8 link types are allowed. }
  345.  
  346. const
  347.   OLEUIPASTE_ENABLEICON    = 2048;  { enable display as icon }
  348.   OLEUIPASTE_PASTEONLY     = 0;
  349.   OLEUIPASTE_PASTE         = 512;
  350.   OLEUIPASTE_LINKANYTYPE   = 1024;
  351.   OLEUIPASTE_LINKTYPE1     = 1;
  352.   OLEUIPASTE_LINKTYPE2     = 2;
  353.   OLEUIPASTE_LINKTYPE3     = 4;
  354.   OLEUIPASTE_LINKTYPE4     = 8;
  355.   OLEUIPASTE_LINKTYPE5     = 16;
  356.   OLEUIPASTE_LINKTYPE6     = 32;
  357.   OLEUIPASTE_LINKTYPE7     = 64;
  358.   OLEUIPASTE_LINKTYPE8     = 128;
  359.  
  360. { TOleUIPasteEntry structure
  361.  
  362.   An array of TOleUIPasteEntry entries is specified for the PasteSpecial
  363.   dialog box. Each entry includes a TFormatEtc which specifies the
  364.   formats that are acceptable, a string that is to represent the format
  365.   in the  dialog's list box, a string to customize the result text of the
  366.   dialog and a set of flags from the OLEUIPASTE_xxx constants.  The
  367.   flags indicate if the entry is valid for pasting only, linking only or
  368.   both pasting and linking. }
  369.  
  370. type
  371.   POleUIPasteEntry = ^TOleUIPasteEntry;
  372.   TOleUIPasteEntry = record
  373.     fmtetc: TFormatEtc;         { Format that is acceptable }
  374.     lpstrFormatName: PChar;     { String that represents the format
  375.                                   to the user. %s is replaced by the
  376.                                   full user type name of the object }
  377.     lpstrResultText: PChar;     { String to customize the result text
  378.                                   of the dialog when the user
  379.                                   selects the format correspoding to
  380.                                   this entry. Any %s in this string
  381.                                   is replaced by the the application
  382.                                   name or FullUserTypeName of the
  383.                                   object on the clipboard }
  384.     dwFlags: Longint;           { Values from OLEUIPASTE_xxx set }
  385.     dwScratchSpace: Longint;    { Scratch space used internally }
  386.   end;
  387.  
  388. { Maximum number of link types }
  389.  
  390. const
  391.   PS_MAXLINKTYPES = 8;
  392.  
  393. type
  394.   POleUIPasteSpecial = ^TOleUIPasteSpecial;
  395.   TOleUIPasteSpecial = record
  396.     cbStruct: Longint;                  { Structure Size }
  397.     dwFlags: Longint;                   { IN-OUT: Flags }
  398.     hWndOwner: HWnd;                    { Owning window }
  399.     lpszCaption: PChar;                 { Dialog caption bar contents }
  400.     lpfnHook: TFNOleUIHook;             { Hook callback }
  401.     lCustData: Longint;                 { Custom data to pass to hook }
  402.     hInstance: THandle;                 { Instance for customized template name }
  403.     lpszTemplate: PChar;                { Customized template name }
  404.     hResource: HRsrc;                   { Customized template handle }
  405.     lpSrcDataObj: IDataObject;          { IN-OUT: Source IDataObject on the clipboard }
  406.     arrPasteEntries: POleUIPasteEntry;  { IN: Array of acceptable formats }
  407.     cPasteEntries: Integer;             { IN: No. of TOleUIPasteEntry array entries }
  408.     arrLinkTypes: PLongint;             { IN: List of acceptable link types }
  409.     cLinkTypes: Integer;                { IN: Number of link types }
  410.     cClsidExclude: Integer;             { IN: Number of CLSIDs in lpClsidExclude }
  411.     lpClsidExclude: PCLSID;             { IN: List of CLSIDs to exclude from list }
  412.     nSelectedIndex: Integer;            { OUT: Index that the user selected }
  413.     fLink: BOOL;                        { OUT: Indicates if Paste or PasteLink }
  414.     hMetaPict: HGlobal;                 { OUT: Handle to Metafile containing icon }
  415.     sizel: TSize;                       { OUT: size of object/link in its source
  416.                                           may be 0,0 if different display
  417.                                           aspect is chosen }
  418.   end;
  419.  
  420. function OleUIPasteSpecial(var Info: TOleUIPasteSpecial): Integer; stdcall;
  421.  
  422. { Paste Special specific flags }
  423.  
  424. const
  425.   PSF_SHOWHELP                    = $00000001;
  426.   PSF_SELECTPASTE                 = $00000002;
  427.   PSF_SELECTPASTELINK             = $00000004;
  428.   PSF_CHECKDISPLAYASICON          = $00000008;
  429.   PSF_DISABLEDISPLAYASICON        = $00000010;
  430.   PSF_HIDECHANGEICON              = $00000020;
  431.   PSF_STAYONCLIPBOARDCHANGE       = $00000040;
  432.   PSF_NOREFRESHDATAOBJECT         = $00000080;
  433.  
  434. { Paste Special specific error codes }
  435.  
  436. const
  437.   OLEUI_IOERR_SRCDATAOBJECTINVALID   = OLEUI_ERR_STANDARDMAX + 0;
  438.   OLEUI_IOERR_ARRPASTEENTRIESINVALID = OLEUI_ERR_STANDARDMAX + 1;
  439.   OLEUI_IOERR_ARRLINKTYPESINVALID    = OLEUI_ERR_STANDARDMAX + 2;
  440.   OLEUI_PSERR_CLIPBOARDCHANGED       = OLEUI_ERR_STANDARDMAX + 3;
  441.   OLEUI_PSERR_GETCLIPBOARDFAILED     = OLEUI_ERR_STANDARDMAX + 4;
  442.  
  443. { **** Edit Links dialog **** }
  444.  
  445. { IOleUILinkContainer interface
  446.  
  447.   This interface must be implemented by container applications that
  448.   want to use the EditLinks dialog. the EditLinks dialog calls back
  449.   to the container app to perform the OLE functions to manipulate
  450.   the links within the container. }
  451.  
  452. type
  453.   IOleUILinkContainer = class(IUnknown)
  454.   public
  455.     function GetNextLink(dwLink: Longint): Longint; virtual; stdcall; abstract;
  456.     function SetLinkUpdateOptions(dwLink: Longint;
  457.       dwUpdateOpt: Longint): HResult; virtual; stdcall; abstract;
  458.     function GetLinkUpdateOptions(dwLink: Longint;
  459.       var dwUpdateOpt: Longint): HResult; virtual; stdcall; abstract;
  460.     function SetLinkSource(dwLink: Longint; pszDisplayName: PChar;
  461.       lenFileName: Longint; var chEaten: Longint;
  462.       fValidateSource: BOOL): HResult; virtual; stdcall; abstract;
  463.     function GetLinkSource(dwLink: Longint; var pszDisplayName: PChar;
  464.       var lenFileName: Longint; var pszFullLinkType: PChar;
  465.       var pszShortLinkType: PChar; var fSourceAvailable: BOOL;
  466.       var fIsSelected: BOOL): HResult; virtual; stdcall; abstract;
  467.     function OpenLinkSource(dwLink: Longint): HResult; virtual; stdcall; abstract;
  468.     function UpdateLink(dwLink: Longint; fErrorMessage: BOOL;
  469.       fErrorAction: BOOL): HResult; virtual; stdcall; abstract;
  470.     function CancelLink(dwLink: Longint): HResult; virtual; stdcall; abstract;
  471.   end;
  472.  
  473. { TOleIUEditLinks structure }
  474.  
  475. type
  476.   POleUIEditLinks = ^TOleUIEditLinks;
  477.   TOleUIEditLinks = record
  478.     cbStruct: Longint;                  { Structure Size }
  479.     dwFlags: Longint;                   { IN-OUT: Flags }
  480.     hWndOwner: HWnd;                    { Owning window }
  481.     lpszCaption: PChar;                 { Dialog caption bar contents }
  482.     lpfnHook: TFNOleUIHook;             { Hook callback }
  483.     lCustData: Longint;                 { Custom data to pass to hook }
  484.     hInstance: THandle;                 { Instance for customized template name }
  485.     lpszTemplate: PChar;                { Customized template name }
  486.     hResource: HRsrc;                   { Customized template handle }
  487.     OleUILinkContainer: IOleUILinkContainer; { IN: Interface to manipulate
  488.                                           links in the container }
  489.   end;
  490.  
  491. const
  492.   OLEUI_ELERR_LINKCNTRNULL    = OLEUI_ERR_STANDARDMAX + 0;
  493.   OLEUI_ELERR_LINKCNTRINVALID = OLEUI_ERR_STANDARDMAX + 1;
  494.  
  495. function OleUIEditLinks(var Info: TOleUIEditLinks): Integer; stdcall;
  496.  
  497. { Edit Links flags }
  498.  
  499. const
  500.   ELF_SHOWHELP                    = $00000001;
  501.   ELF_DISABLEUPDATENOW            = $00000002;
  502.   ELF_DISABLEOPENSOURCE           = $00000004;
  503.   ELF_DISABLECHANGESOURCE         = $00000008;
  504.   ELF_DISABLECANCELLINK           = $00000010;
  505.  
  506. { **** Change Icon dialog **** }
  507.  
  508. type
  509.   POleUIChangeIcon = ^TOleUIChangeIcon;
  510.   TOleUIChangeIcon = record
  511.     cbStruct: Longint;                  { Structure Size }
  512.     dwFlags: Longint;                   { IN-OUT: Flags }
  513.     hWndOwner: HWnd;                    { Owning window }
  514.     lpszCaption: PChar;                 { Dialog caption bar contents }
  515.     lpfnHook: TFNOleUIHook;             { Hook callback }
  516.     lCustData: Longint;                 { Custom data to pass to hook }
  517.     hInstance: THandle;                 { Instance for customized template name }
  518.     lpszTemplate: PChar;                { Customized template name }
  519.     hResource: HRsrc;                   { Customized template handle }
  520.     hMetaPict: HGlobal;                 { IN-OUT: Current and final image.
  521.                                           Source of the icon is embedded in
  522.                                           the metafile itself }
  523.     clsid: TCLSID;                      { IN: class used to get Default icon }
  524.     szIconExe: array[0..MAX_PATH - 1] of Char; { IN: exlicit icon source path }
  525.     cchIconExe: Integer;                { IN: number of characters in szIconExe }
  526.   end;
  527.  
  528. function OleUIChangeIcon(var Info: TOleUIChangeIcon): Integer; stdcall;
  529.  
  530. { Change Icon flags }
  531.  
  532. const
  533.   CIF_SHOWHELP                    = $00000001;
  534.   CIF_SELECTCURRENT               = $00000002;
  535.   CIF_SELECTDEFAULT               = $00000004;
  536.   CIF_SELECTFROMFILE              = $00000008;
  537.   CIF_USEICONEXE                  = $00000010;
  538.  
  539. { Change Icon specific error codes }
  540.  
  541. const
  542.   OLEUI_CIERR_MUSTHAVECLSID           = OLEUI_ERR_STANDARDMAX + 0;
  543.   OLEUI_CIERR_MUSTHAVECURRENTMETAFILE = OLEUI_ERR_STANDARDMAX + 1;
  544.   OLEUI_CIERR_SZICONEXEINVALID        = OLEUI_ERR_STANDARDMAX + 2;
  545.  
  546. { Property used by ChangeIcon dialog to give its parent window access to
  547.   its hDlg. The PasteSpecial dialog may need to force the ChgIcon dialog
  548.   down if the clipboard contents change underneath it. If so it will send
  549.   a IDCANCEL command to the ChangeIcon dialog. }
  550.  
  551. const
  552.   PROP_HWND_CHGICONDLG = 'HWND_CIDLG';
  553.  
  554. { **** Convert dialog **** }
  555.  
  556. type
  557.   POleUIConvert = ^TOleUIConvert;
  558.   TOleUIConvert = record
  559.     cbStruct: Longint;                  { Structure Size }
  560.     dwFlags: Longint;                   { IN-OUT: Flags }
  561.     hWndOwner: HWnd;                    { Owning window }
  562.     lpszCaption: PChar;                 { Dialog caption bar contents }
  563.     lpfnHook: TFNOleUIHook;             { Hook callback }
  564.     lCustData: Longint;                 { Custom data to pass to hook }
  565.     hInstance: THandle;                 { Instance for customized template name }
  566.     lpszTemplate: PChar;                { Customized template name }
  567.     hResource: HRsrc;                   { Customized template handle }
  568.     clsid: TCLSID;                      { IN: Class ID sent in to dialog: IN only }
  569.     clsidConvertDefault: TCLSID;        { IN: use as convert default: IN only }
  570.     clsidActivateDefault: TCLSID;       { IN: use as activate default: IN only }
  571.     clsidNew: TCLSID;                   { OUT: Selected Class ID }
  572.     dvAspect: Longint;                  { IN-OUT: either DVASPECT_CONTENT or
  573.                                           DVASPECT_ICON }
  574.     wFormat: Word;                      { IN" Original data format }
  575.     fIsLinkedObject: BOOL;              { IN: true if object is linked }
  576.     hMetaPict: HGlobal;                 { IN-OUT: metafile icon image }
  577.     lpszUserType: PChar;                { IN-OUT: user type name of original class.
  578.                                           We'll do lookup if NULL. This gets freed
  579.                                           on exit }
  580.     fObjectsIconChanged: BOOL;          { OUT: TRUE == ChangeIcon was called }
  581.     lpszDefLabel: PChar;                { IN-OUT: default label to use for icon.
  582.                                           if NULL, the short user type name
  583.                                           will be used. if the object is a
  584.                                           link, the caller should pass the
  585.                                           DisplayName of the link source
  586.                                           This gets freed on exit }
  587.     cClsidExclude: Integer;             { IN: No. of CLSIDs in lpClsidExclude }
  588.     lpClsidExclude: PCLSID;             { IN: List of CLSIDs to exclude from list }
  589.   end;
  590.  
  591. function OleUIConvert(var Info: TOleUIConvert): Integer; stdcall;
  592.  
  593. { Determine if there is at least one class that can Convert or ActivateAs
  594.   the given clsid }
  595.  
  596. function OleUICanConvertOrActivateAs(const clsid: TCLSID;
  597.   fIsLinkedObject: BOOL; wFormat: Word): BOOL; stdcall;
  598.  
  599. { Convert Dialog flags }
  600.  
  601. const
  602.   CF_SHOWHELPBUTTON               = $00000001;
  603.   CF_SETCONVERTDEFAULT            = $00000002;
  604.   CF_SETACTIVATEDEFAULT           = $00000004;
  605.   CF_SELECTCONVERTTO              = $00000008;
  606.   CF_SELECTACTIVATEAS             = $00000010;
  607.   CF_DISABLEDISPLAYASICON         = $00000020;
  608.   CF_DISABLEACTIVATEAS            = $00000040;
  609.   CF_HIDECHANGEICON               = $00000080;
  610.   CF_CONVERTONLY                  = $00000100;
  611.  
  612. { Convert specific error codes }
  613.  
  614. const
  615.   OLEUI_CTERR_CLASSIDINVALID      = OLEUI_ERR_STANDARDMAX + 1;
  616.   OLEUI_CTERR_DVASPECTINVALID     = OLEUI_ERR_STANDARDMAX + 2;
  617.   OLEUI_CTERR_CBFORMATINVALID     = OLEUI_ERR_STANDARDMAX + 3;
  618.   OLEUI_CTERR_HMETAPICTINVALID    = OLEUI_ERR_STANDARDMAX + 4;
  619.   OLEUI_CTERR_STRINGINVALID       = OLEUI_ERR_STANDARDMAX + 5;
  620.  
  621. { **** Busy dialog **** }
  622.  
  623. type
  624.   POleUIBusy = ^TOleUIBusy;
  625.   TOleUIBusy = record
  626.     cbStruct: Longint;                  { Structure Size }
  627.     dwFlags: Longint;                   { IN-OUT: Flags }
  628.     hWndOwner: HWnd;                    { Owning window }
  629.     lpszCaption: PChar;                 { Dialog caption bar contents }
  630.     lpfnHook: TFNOleUIHook;             { Hook callback }
  631.     lCustData: Longint;                 { Custom data to pass to hook }
  632.     hInstance: THandle;                 { Instance for customized template name }
  633.     lpszTemplate: PChar;                { Customized template name }
  634.     hResource: HRsrc;                   { Customized template handle }
  635.     task: HTask;                        { IN: HTask which is blocking }
  636.     lphWndDialog: ^HWnd;                { IN: Dialog's HWND is placed here }
  637.   end;
  638.  
  639. function OleUIBusy(var Info: TOleUIBusy): Integer; stdcall;
  640.  
  641. { Flags for the Busy dialog }
  642.  
  643. const
  644.   BZ_DISABLECANCELBUTTON          = $00000001;
  645.   BZ_DISABLESWITCHTOBUTTON        = $00000002;
  646.   BZ_DISABLERETRYBUTTON           = $00000004;
  647.   BZ_NOTRESPONDINGDIALOG          = $00000008;
  648.  
  649. { Busy specific error/return codes }
  650.  
  651. const
  652.   OLEUI_BZERR_HTASKINVALID     = OLEUI_ERR_STANDARDMAX + 0;
  653.   OLEUI_BZ_SWITCHTOSELECTED    = OLEUI_ERR_STANDARDMAX + 1;
  654.   OLEUI_BZ_RETRYSELECTED       = OLEUI_ERR_STANDARDMAX + 2;
  655.   OLEUI_BZ_CALLUNBLOCKED       = OLEUI_ERR_STANDARDMAX + 3;
  656.  
  657. { **** Object Properties dialog **** }
  658.  
  659. type
  660.   IOleUIObjInfo = class(IUnknown)
  661.   public
  662.     function GetObjectInfo(dwObject: Longint;
  663.       var dwObjSize: Longint; var lpszLabel: PChar;
  664.       var lpszType: PChar; var lpszShortType: PChar;
  665.       var lpszLocation: PChar): HResult; virtual; stdcall; abstract;
  666.     function GetConvertInfo(dwObject: Longint; var ClassID: TCLSID;
  667.       var wFormat: Word; var ConvertDefaultClassID: TCLSID;
  668.       var lpClsidExclude: PCLSID; var cClsidExclude: Longint): HResult;
  669.       virtual; stdcall; abstract;
  670.     function ConvertObject(dwObject: Longint;
  671.       const clsidNew: TCLSID): HResult; virtual; stdcall; abstract;
  672.     function GetViewInfo(dwObject: Longint; var hMetaPict: HGlobal;
  673.       var dvAspect: Longint; var nCurrentScale: Integer): HResult;
  674.       virtual; stdcall; abstract;
  675.     function SetViewInfo(dwObject: Longint; hMetaPict: HGlobal;
  676.       dvAspect: Longint; nCurrentScale: Integer;
  677.       bRelativeToOrig: BOOL): HResult; virtual; stdcall; abstract;
  678.   end;
  679.  
  680. type
  681.   IOleUILinkInfo = class(IOleUILinkContainer)
  682.   public
  683.     function GetLastUpdate(dwLink: Longint;
  684.       var LastUpdate: TFileTime): HResult; virtual; stdcall; abstract;
  685.   end;
  686.  
  687. type
  688.   POleUIGnrlProps = ^TOleUIGnrlProps;
  689.   TOleUIGnrlProps = record
  690.     cbStruct: Longint;
  691.     dwFlags: Longint;
  692.     dwReserved1: array[1..2] of Longint;
  693.     lpfnHook: TFNOleUIHook;
  694.     lCustData: Longint;
  695.     dwReserved2: array[1..3] of Longint;
  696.     lpOP: Pointer;
  697.   end;
  698.  
  699. type
  700.   POleUIViewProps = ^TOleUIViewProps;
  701.   TOleUIViewProps = record
  702.     cbStruct: Longint;
  703.     dwFlags: Longint;
  704.     dwReserved1: array[1..2] of Longint;
  705.     lpfnHook: TFNOleUIHook;
  706.     lCustData: Longint;
  707.     dwReserved2: array[1..3] of Longint;
  708.     lpOP: Pointer;
  709.     nScaleMin: Integer;
  710.     nScaleMax: Integer;
  711.   end;
  712.  
  713. { Flags for TOleUIViewProps }
  714.  
  715. const
  716.   VPF_SELECTRELATIVE          = $00000001;  { IN: relative to orig }
  717.   VPF_DISABLERELATIVE         = $00000002;  { IN: disable relative to orig }
  718.   VPF_DISABLESCALE            = $00000004;  { IN: disable scale option }
  719.  
  720. type
  721.   POleUILinkProps = ^TOleUILinkProps;
  722.   TOleUILinkProps = record
  723.     cbStruct: Longint;
  724.     dwFlags: Longint;
  725.     dwReserved1: array[1..2] of Longint;
  726.     lpfnHook: TFNOleUIHook;
  727.     lCustData: Longint;
  728.     dwReserved2: array[1..3] of Longint;
  729.     lpOP: Pointer;
  730.   end;
  731.  
  732. type
  733.   POleUIObjectProps = ^TOleUIObjectProps;
  734.   TOleUIObjectProps = record
  735.     cbStruct: Longint;          { Structure Size }
  736.     dwFlags: Longint;           { IN-OUT: global flags for the sheet }
  737.     lpPS: PPropSheetHeader;     { IN: property sheet header }
  738.     dwObject: Longint;          { IN: identifier for the object }
  739.     lpObjInfo: IOleUIObjInfo;   { IN: interface to manipulate object }
  740.     dwLink: Longint;            { IN: identifier for the link }
  741.     lpLinkInfo: IOleUILinkInfo; { IN: interface to manipulate link }
  742.     lpGP: POleUIGnrlProps;      { IN: general page }
  743.     lpVP: POleUIViewProps;      { IN: view page }
  744.     lpLP: POleUILinkProps;      { IN: link page }
  745.   end;
  746.  
  747. function OleUIObjectProperties(var Info: TOleUIObjectProps): Integer; stdcall;
  748.  
  749. { Flags for OLEUIOBJECTPROPS }
  750.  
  751. const
  752.   OPF_OBJECTISLINK                = $00000001;
  753.   OPF_NOFILLDEFAULT               = $00000002;
  754.   OPF_SHOWHELP                    = $00000004;
  755.   OPF_DISABLECONVERT              = $00000008;
  756.  
  757. { Errors for OleUIObjectProperties }
  758.  
  759. const
  760.   OLEUI_OPERR_SUBPROPNULL           = OLEUI_ERR_STANDARDMAX + 0;
  761.   OLEUI_OPERR_SUBPROPINVALID        = OLEUI_ERR_STANDARDMAX + 1;
  762.   OLEUI_OPERR_PROPSHEETNULL         = OLEUI_ERR_STANDARDMAX + 2;
  763.   OLEUI_OPERR_PROPSHEETINVALID      = OLEUI_ERR_STANDARDMAX + 3;
  764.   OLEUI_OPERR_SUPPROP               = OLEUI_ERR_STANDARDMAX + 4;
  765.   OLEUI_OPERR_PROPSINVALID          = OLEUI_ERR_STANDARDMAX + 5;
  766.   OLEUI_OPERR_PAGESINCORRECT        = OLEUI_ERR_STANDARDMAX + 6;
  767.   OLEUI_OPERR_INVALIDPAGES          = OLEUI_ERR_STANDARDMAX + 7;
  768.   OLEUI_OPERR_NOTSUPPORTED          = OLEUI_ERR_STANDARDMAX + 8;
  769.   OLEUI_OPERR_DLGPROCNOTNULL        = OLEUI_ERR_STANDARDMAX + 9;
  770.   OLEUI_OPERR_LPARAMNOTZERO         = OLEUI_ERR_STANDARDMAX + 10;
  771.   OLEUI_GPERR_STRINGINVALID         = OLEUI_ERR_STANDARDMAX + 11;
  772.   OLEUI_GPERR_CLASSIDINVALID        = OLEUI_ERR_STANDARDMAX + 12;
  773.   OLEUI_GPERR_LPCLSIDEXCLUDEINVALID = OLEUI_ERR_STANDARDMAX + 13;
  774.   OLEUI_GPERR_CBFORMATINVALID       = OLEUI_ERR_STANDARDMAX + 14;
  775.   OLEUI_VPERR_METAPICTINVALID       = OLEUI_ERR_STANDARDMAX + 15;
  776.   OLEUI_VPERR_DVASPECTINVALID       = OLEUI_ERR_STANDARDMAX + 16;
  777.   OLEUI_LPERR_LINKCNTRNULL          = OLEUI_ERR_STANDARDMAX + 17;
  778.   OLEUI_LPERR_LINKCNTRINVALID       = OLEUI_ERR_STANDARDMAX + 18;
  779.   OLEUI_OPERR_PROPERTYSHEET         = OLEUI_ERR_STANDARDMAX + 19;
  780.  
  781. { wParam used by PSM_QUERYSIBLINGS }
  782.  
  783. const
  784.   OLEUI_QUERY_GETCLASSID          = $FF00;  { override class id for icon }
  785.   OLEUI_QUERY_LINKBROKEN          = $FF01;  { after link broken }
  786.  
  787. implementation
  788.  
  789. const
  790.   OleDlgDLL = 'oledlg.dll';
  791.  
  792. function OleUIAddVerbMenu;              external OleDlgDLL name 'OleUIAddVerbMenuA';
  793. function OleUIInsertObject;             external OleDlgDLL name 'OleUIInsertObjectA';
  794. function OleUIPasteSpecial;             external OleDlgDLL name 'OleUIPasteSpecialA';
  795. function OleUIEditLinks;                external OleDlgDLL name 'OleUIEditLinksA';
  796. function OleUIChangeIcon;               external OleDlgDLL name 'OleUIChangeIconA';
  797. function OleUIConvert;                  external OleDlgDLL name 'OleUIConvertA';
  798. function OleUICanConvertOrActivateAs;   external OleDlgDLL name 'OleUICanConvertOrActivateAs';
  799. function OleUIBusy;                     external OleDlgDLL name 'OleUIBusyA';
  800. function OleUIObjectProperties;         external OleDlgDLL name 'OleUIObjectPropertiesA';
  801.  
  802. end.
  803.