diff --git a/PInvoke/OleDlg/OleDlg.cs b/PInvoke/OleDlg/OleDlg.cs index 56c4d9f7..eab2b9d3 100644 --- a/PInvoke/OleDlg/OleDlg.cs +++ b/PInvoke/OleDlg/OleDlg.cs @@ -1,14 +1,15 @@ using System; using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; using static Vanara.PInvoke.Kernel32; +using static Vanara.PInvoke.Ole32; +using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; namespace Vanara.PInvoke { /// Functions, interfaces and structures from Windows OleDlg.dll. public static partial class OleDlg { - //[ComImport, Guid("EEDD23E0-8410-11CE-A1C3-08002B2B8D8F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - private const string Lib_OleDlg = "oledlg.dll"; /// A hook function that processes messages intended for the dialog box. @@ -44,6 +45,51 @@ namespace Vanara.PInvoke BZ_NOTRESPONDINGDIALOG = 0x00000008, } + /// On input, this field specifies the initialization and creation flags. On exit, it specifies the user's choices. + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUICONVERTA")] + [Flags] + public enum CF + { + /// Dialog box will display a Help button. This flag is set on input. + CF_SHOWHELPBUTTON = 0x0001, + + /// + /// Class whose CLSID is specified by clsidConvertDefault will be used as the default selection. This selection appears in the + /// class listbox when the Convert To radio button is selected. This flag is set on input. + /// + CF_SETCONVERTDEFAULT = 0x0002, + + /// + /// Class whose CLSID is specified by clsidActivateDefault will be used as the default selection. This selection appears in the + /// class listbox when the Activate As radio button is selected. This flag is set on input. + /// + CF_SETACTIVATEDEFAULT = 0x0004, + + /// + /// On input, this flag specifies that Convert To will be initially selected (default behavior). This flag is set on output if + /// Convert To was selected when the user dismissed the dialog box. + /// + CF_SELECTCONVERTTO = 0x0008, + + /// + /// On input, this flag specifies that Activate As will be initially selected. This flag is set on output if Activate As was + /// selected when the user dismissed the dialog box. + /// + CF_SELECTACTIVATEAS = 0x0010, + + /// The Display As Icon button will be disabled on initialization. + CF_DISABLEDISPLAYASICON = 0x0020, + + /// The Activate As radio button will be disabled on initialization. + CF_DISABLEACTIVATEAS = 0x0040, + + /// The Change Icon button will be hidden in the Convert dialog box. + CF_HIDECHANGEICON = 0x0080, + + /// The Activate As radio button will be disabled in the Convert dialog box. + CF_CONVERTONLY = 0x0100, + } + /// Initialization and creation flags for . [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUICHANGEICONA")] [Flags] @@ -91,6 +137,88 @@ namespace Vanara.PInvoke CSF_EXPLORER = 0x00000008, } + /// On input, dwFlags specifies the initialization and creation flags. + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIEDITLINKSA")] + [Flags] + public enum ELF + { + /// Specifies that the dialog box will display a Help button. + ELF_SHOWHELP = 0x01, + + /// Specifies that the Update Now button will be disabled on initialization. + ELF_DISABLEUPDATENOW = 0x02, + + /// Specifies that the Open Source button will be disabled on initialization. + ELF_DISABLEOPENSOURCE = 0x04, + + /// Specifies that the Change Source button will be disabled on initialization. + ELF_DISABLECHANGESOURCE = 0x08, + + /// Specifies that the Cancel Link button will be disabled on initialization. + ELF_DISABLECANCELLINK = 0x10, + } + + /// On input, specifies the initialization and creation flags. On exit, specifies the user's choices. + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIINSERTOBJECTA")] + [Flags] + public enum IOF + { + /// The dialog box will display a Help button. + IOF_SHOWHELP = 0x00000001, + + /// The Create New radio button will initially be checked. This cannot be used with IOF_SELECTCREATEFROMFILE. + IOF_SELECTCREATENEW = 0x00000002, + + /// The Create From File radio button will initially be checked. This cannot be used with IOF_SELECTCREATENEW. + IOF_SELECTCREATEFROMFILE = 0x00000004, + + /// The Link check box will initially be checked. + IOF_CHECKLINK = 0x00000008, + + /// + /// The Display As Icon check box will initially be checked, the current icon will be displayed, and the Change Icon button will + /// be enabled. + /// + IOF_CHECKDISPLAYASICON = 0x00000010, + + /// + /// A new object should be created when the user selects OK to dismiss the dialog box and the Create New radio button was selected. + /// + IOF_CREATENEWOBJECT = 0x00000020, + + /// + /// A new object should be created from the specified file when the user selects OK to dismiss the dialog box and the Create + /// From File radio button was selected. + /// + IOF_CREATEFILEOBJECT = 0x00000040, + + /// + /// A new linked object should be created when the user selects OK to dismiss the dialog box and the user checked the Link check box. + /// + IOF_CREATELINKOBJECT = 0x00000080, + + /// The Link check box will be disabled on initialization. + IOF_DISABLELINK = 0x00000100, + + /// + /// The dialog box should validate the classes it adds to the listbox by ensuring that the server specified in the registration + /// database exists. This is a significant performance factor. + /// + IOF_VERIFYSERVERSEXIST = 0x00000200, + + /// The Display As Icon check box will be disabled on initialization. + IOF_DISABLEDISPLAYASICON = 0x00000400, + + /// The Change Icon button will be hidden in the Insert Object dialog box. + IOF_HIDECHANGEICON = 0x00000800, + + /// Displays the Insert Control radio button. + IOF_SHOWINSERTCONTROL = 0x00001000, + + /// Displays the Create Control radio button. + IOF_SELECTCREATECONTROL = 0x00002000, + } + /// /// Indicates the user options that are available to the user when pasting this format, and within which group or list of choices ( /// Paste, Paste Link, etc.). @@ -149,6 +277,807 @@ namespace Vanara.PInvoke OLEUIPASTE_LINKTYPE8 = 128, } + /// Contains in/out global flags for the property sheet. + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIOBJECTPROPSA")] + [Flags] + public enum OPF + { + /// Object is a link object and therefore has a link property page. + OPF_OBJECTISLINK = 0x00000001, + + /// Do not fill in default values for the object. + OPF_NOFILLDEFAULT = 0x00000002, + + /// The dialog box will display a Help button. + OPF_SHOWHELP = 0x00000004, + + /// The Convert button will be disabled on the general property page. + OPF_DISABLECONVERT = 0x00000008, + } + + /// On input, dwFlags specifies the initialization and creation flags. On exit, it specifies the user's choices. + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIPASTESPECIALA")] + [Flags] + public enum PSF + { + /// Dialog box will display a Help button. + PSF_SHOWHELP = 0x00000001, + + /// + /// The Paste radio button will be selected at dialog box startup. This is the default, if PSF_SELECTPASTE or + /// PSF_SELECTPASTELINK are not specified. Also, it specifies the state of the button on dialog termination. IN/OUT flag. + /// + PSF_SELECTPASTE = 0x00000002, + + /// + /// The PasteLink radio button will be selected at dialog box startup. Also, specifies the state of the button on dialog + /// termination. IN/OUT flag. + /// + PSF_SELECTPASTELINK = 0x00000004, + + /// Whether the Display As Icon radio button was checked on dialog box termination. OUT flag. + PSF_CHECKDISPLAYASICON = 0x00000008, + + /// The Display As Icon check box will be disabled on initialization. + PSF_DISABLEDISPLAYASICON = 0x00000010, + + /// + /// Used to disable the change-icon button in the dialog box, which is available to users when they're pasting an OLE object by + /// default. See STAYONCLIPBOARDCHANGE otherwise. + /// + PSF_HIDECHANGEICON = 0x00000020, + + /// + /// Used to tell the dialog box to stay up if the clipboard changes while the dialog box is up. If the user switches to another + /// application and copies or cuts something, the dialog box will, by default, perform a cancel operation, which will remove the + /// dialog box since the options it's in the middle of presenting to the user are no longer up-to-date with respect to what's + /// really on the clipboard. + /// + PSF_STAYONCLIPBOARDCHANGE = 0x00000040, + + /// + /// Used in conjunction with STAYONCLIPBOARDCHANGE (it doesn't do anything otherwise). If the clipboard changes while the dialog + /// box is up and STAYONCLIPBOARDCHANGE is specified, then NOREFRESHDATAOBJECT indicates that the dialog box should NOT refresh + /// the contents of the dialog box to reflect the new contents of the clipboard. This is useful if the application is using the + /// paste-special dialog box on an IDataObject besides the one on the clipboard, for example, as part of a right-click + /// drag-and-drop operation. + /// + PSF_NOREFRESHDATAOBJECT = 0x00000080, + } + + /// Flags specific to view page + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIVIEWPROPSA")] + [Flags] + public enum VPF : uint + { + /// Relative to origin. + VPF_SELECTRELATIVE = 0x00000001, + + /// Disable relative to origin. + VPF_DISABLERELATIVE = 0x00000002, + + /// Disable scale option. + VPF_DISABLESCALE = 0x00000004, + } + + /// + /// + /// Implemented by containers and used by OLE common dialog boxes. It supports these dialog boxes by providing the methods needed to + /// manage a container's links. + /// + /// + /// The IOleUILinkContainer methods enumerate the links associated with a container, and specify how they should be updated, + /// automatically or manually. They change the source of a link and obtain information associated with a link. They also open a + /// link's source document, update links, and break a link to the source. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nn-oledlg-ioleuilinkcontainerw + [PInvokeData("oledlg.h", MSDNShortId = "NN:oledlg.IOleUILinkContainerW")] + [ComImport, Guid("000004ff-0000-0000-c000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IOleUILinkContainer + { + /// Enumerates the links in a container. + /// + /// Container-defined unique identifier for a single link. This value is only passed to other methods on this interface, so it + /// can be any value that uniquely identifies a link to the container. Containers frequently use the pointer to the link's + /// container site object for this value. + /// + /// Returns a container's link identifiers in sequence; NULL if it has returned the last link. + /// + /// Notes to Callers + /// + /// Call this method to enumerate the links in a container. If the value passed in dwLink is NULL, then the container + /// should return the first link's identifier. If dwLink identifies the last link in the container, then the container should + /// return NULL. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuilinkcontainera-getnextlink DWORD GetNextLink( DWORD + // dwLink ); + [PreserveSig] + uint GetNextLink(uint dwLink); + + /// Sets a link's update options to automatic or manual. + /// Container-defined unique identifier for a single link. See IOleUILinkContainer::GetNextLink. + /// Update options, which can be automatic (OLEUPDATE_ALWAYS) or manual (OLEUPDATE_ONCALL). + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Implementers + /// Containers can implement this method for OLE links by simply calling IOleLink::SetUpdateOptions on the link object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuilinkcontainera-setlinkupdateoptions HRESULT + // SetLinkUpdateOptions( DWORD dwLink, DWORD dwUpdateOpt ); + [PreserveSig] + HRESULT SetLinkUpdateOptions(uint dwLink, uint dwUpdateOpt); + + /// Determines the current update options for a link. + /// Container-defined unique identifier for a single link. See IOleUILinkContainer::GetNextLink. + /// A pointer to the location that the current update options will be written. + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Implementers + /// Containers can implement this method for OLE links simply by calling IOleLink::SetUpdateOptions on the link object. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuilinkcontainera-getlinkupdateoptions HRESULT + // GetLinkUpdateOptions( DWORD dwLink, DWORD *lpdwUpdateOpt ); + [PreserveSig] + HRESULT GetLinkUpdateOptions(uint dwLink, out uint lpdwUpdateOpt); + + /// Changes the source of a link. + /// Container-defined unique identifier for a single link. See IOleUILinkContainer::GetNextLink. + /// Pointer to new source string to be parsed. + /// + /// Length of the leading file name portion of the lpszDisplayName string. If the link source is not stored in a file, then + /// lenFileName should be 0. For OLE links, call IOleLink::GetSourceDisplayName. + /// + /// Pointer to the number of characters successfully parsed in lpszDisplayName. + /// + /// TRUE if the moniker should be validated; for OLE links, MkParseDisplayName should be called. FALSE if the + /// moniker should not be validated. If possible, the link should accept the unvalidated source, and mark itself as unavailable. + /// + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The supplied identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// Insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Callers + /// + /// Call this method from the Change Source dialog box, with fValidateSource initially set to TRUE. Change + /// Source can be called directly or from the Links dialog box. If this call to + /// IOleUILinkContainer::SetLinkSource returns an error (e.g., MkParseDisplayName failed because the source was + /// unavailable), then you should display an Invalid Link Source message, and the user should be allowed to decide + /// whether to fix the source. If the user chooses to fix the source, then the user should be returned to the Change + /// Source dialog box with the invalid portion of the input string highlighted. If the user chooses not to fix the source, + /// then IOleUILinkContainer::SetLinkSource should be called a second time with fValidateSource set to FALSE, and + /// the user should be returned to the Links dialog box with the link marked Unavailable. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuilinkcontainera-setlinksource HRESULT SetLinkSource( + // DWORD dwLink, LPSTR lpszDisplayName, ULONG lenFileName, ULONG *pchEaten, BOOL fValidateSource ); + [PreserveSig] + HRESULT SetLinkSource(uint dwLink, [MarshalAs(UnmanagedType.LPStr)] string lpszDisplayName, + uint lenFileName, out uint pchEaten, [MarshalAs(UnmanagedType.Bool)] bool fValidateSource); + + /// Retrieves information about a link that can be displayed in the Links dialog box. + /// Container-defined unique identifier for a single link. See IOleUILinkContainer::GetNextLink. + /// + /// Address of a pointer variable that receives a pointer to the full display name string for the link source. The Links + /// dialog box will free this string. + /// + /// + /// Pointer to the length of the leading file name portion of the lplpszDisplayName string. If the link source is not stored in + /// a file, then lplenFileName should be 0. For OLE links, call IOleLink::GetSourceDisplayName. + /// + /// + /// Address of a pointer variable that receives a pointer to the full link type string that is displayed at the bottom of the + /// Links dialog box. The caller allocates this string. The Links dialog box will free this string. For OLE links, + /// this should be the full User Type name. Use IOleObject::GetUserType, specifying USERCLASSTYPE_FULL for dwFormOfType. + /// + /// + /// Address of a pointer variable that receives a pointer to the short link type string that is displayed in the listbox of the + /// Links dialog box. The caller allocates this string. The Links dialog box will free this string. For OLE links, + /// this should be the short user type name. Use IOleObject::GetUserType, specifying USERCLASSTYPE_SHORT for dwFormOfType. + /// + /// + /// Pointer that returns FALSE if it is known that a link is unavailable since the link is to some known but unavailable + /// document. Certain options, such as Update Now, are disabled (grayed in the user interface) for such cases. + /// + /// + /// Pointer to a variable that tells the Edit Links dialog box that this link's entry should be selected in the dialog's + /// multi-selection listbox. OleUIEditLinks calls this method at least once for each item to be placed in the links list. If + /// none of them return TRUE, then none of them will be selected when the dialog box is first displayed. If all of them + /// return TRUE, then all will be displayed. That is, it returns TRUE if this link is currently part of the + /// selection in the underlying document, FALSE if not. Any links that are selected in the underlying document are + /// selected in the dialog box; this way, the user can select a set of links and use the dialog box to update them or change + /// their source(s) simultaneously. + /// + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Callers + /// Call this method during dialog box initialization, after returning from the Change Source dialog box. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuilinkcontainera-getlinksource HRESULT GetLinkSource( + // DWORD dwLink, LPSTR *lplpszDisplayName, ULONG *lplenFileName, LPSTR *lplpszFullLinkType, LPSTR *lplpszShortLinkType, BOOL + // *lpfSourceAvailable, BOOL *lpfIsSelected ); + [PreserveSig] + HRESULT GetLinkSource(uint dwLink, [MarshalAs(UnmanagedType.LPStr)] out string lplpszDisplayName, out uint lplenFileName, + [MarshalAs(UnmanagedType.LPStr)] out string lplpszFullLinkType, [MarshalAs(UnmanagedType.LPStr)] out string lplpszShortLinkType, + [MarshalAs(UnmanagedType.Bool)] out bool lpfSourceAvailable, [MarshalAs(UnmanagedType.Bool)] out bool lpfIsSelected); + + /// Opens the link's source. + /// + /// Container-defined unique identifier for a single link. Containers can use the pointer to the link's container site for this value. + /// + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Callers + /// + /// The IOleUILinkContainer::OpenLinkSource method is called when the Open Source button is selected from the + /// Links dialog box. For OLE links, call IOleObject::DoVerb, specifying OLEIVERB_SHOW for iVerb. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuilinkcontainera-openlinksource HRESULT + // OpenLinkSource( DWORD dwLink ); + [PreserveSig] + HRESULT OpenLinkSource(uint dwLink); + + /// Forces selected links to connect to their source and retrieve current information. + /// + /// Container-defined unique identifier for a single link. Containers can use the pointer to the link's container site for this value. + /// + /// + /// Determines whether the caller (implementer of IOleUILinkContainer) should show an error message upon failure to update a + /// link. The Update Links dialog box sets this to FALSE. The Object Properties and Links dialog + /// boxes set it to TRUE. + /// + /// This parameter is reserved and must be set to FALSE. + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Callers + /// + /// Call this method with fErrorMessage set to TRUE in cases where the user expressly presses a button to have a link + /// updated, that is, presses the links' Update Now button. Call it with FALSE in cases where the container should + /// never display an error message, that is, where a large set of operations are being performed and the error should be + /// propagated back to the user later, as might occur with the Update links progress meter. Rather than providing one + /// message for each failure, assuming there are failures, provide a single message for all failures at the end of the operation. + /// + /// Notes to Implementers + /// For OLE links, call IOleObject::Update. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuilinkcontainera-updatelink HRESULT UpdateLink( DWORD + // dwLink, BOOL fErrorMessage, BOOL fReserved ); + [PreserveSig] + HRESULT UpdateLink(uint dwLink, [MarshalAs(UnmanagedType.Bool)] bool fErrorMessage, [MarshalAs(UnmanagedType.Bool)] bool fReserved); + + /// Disconnects the selected links. + /// + /// Container-defined unique identifier for a single link. Containers can use the pointer to the link's container site for this value. + /// + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Callers + /// + /// Call IOleUILinkContainer::CancelLink when the user selects the Break Link button from the Links dialog + /// box. The link should be converted to a picture. The Links dialog box will not be dismissed for OLE links. + /// + /// Notes to Implementers + /// + /// For OLE links, OleCreateStaticFromData can be used to create a static picture object using the IDataObject interface of the + /// link as the source. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuilinkcontainera-cancellink HRESULT CancelLink( DWORD + // dwLink ); + [PreserveSig] + HRESULT CancelLink(uint dwLink); + } + + /// + /// An extension of the IOleUILinkContainer interface. It returns the time that an object was last updated, which is link + /// information that IOleUILinkContainer does not provide. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nn-oledlg-ioleuilinkinfoa + [PInvokeData("oledlg.h", MSDNShortId = "NN:oledlg.IOleUILinkInfoA")] + public interface IOleUILinkInfo : IOleUILinkContainer + { + /// Determines the last time the object was updated. + /// + /// Container-defined unique identifier for a single link. Containers can use the pointer to the link's container site for this value. + /// + /// A pointer to a FILETIME structure that indicates the time that the object was last updated. + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Implementers + /// + /// If the time that the object was last updated is known, copy it to lpLastUpdate. If it is not known, then leave lpLastUpdate + /// unchanged and Unknown will be displayed in the link page. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuilinkinfoa-getlastupdate HRESULT GetLastUpdate( + // DWORD dwLink, FILETIME *lpLastUpdate ); + [PreserveSig] + HRESULT GetLastUpdate(uint dwLink, out FILETIME lpLastUpdate); + } + + /// + /// Implemented by containers and used by the container's Object Properties dialog box and by the Convert dialog box. + /// It provides information used by the General and View pages of the Object Properties dialog box , which + /// display information about the object's size, location, type, and name. It also allows the object to be converted using the + /// Convert dialog box. The View page allows the object's icon to be modified from its original form, and its display + /// aspect to be changed (iconic versus content). Optionally, you can have your implementation of this interface allow the scale of + /// the object to be changed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nn-oledlg-ioleuiobjinfow + [PInvokeData("oledlg.h", MSDNShortId = "NN:oledlg.IOleUIObjInfoW")] + public interface IOleUIObjInfo + { + /// Converts the object to the type of the specified CLSID. + /// A unique identifier for the object. + /// The CLSID. + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is not valid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Implementers + /// + /// Your implementation of IOleUIObjInfo::ConvertObject needs to convert the object to the CLSID specified. The actions + /// taken by the convert operation are similar to the actions taken after calling OleUIConvert. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuiobjinfoa-convertobject HRESULT ConvertObject( DWORD + // dwObject, REFCLSID clsidNew ); + [PreserveSig] + HRESULT ConvertObject(uint dwObject, in Guid clsidNew); + + /// Gets the conversion information associated with the specified object. + /// Unique identifier for the object. + /// Pointer to the location to return the object's CLSID. + /// Pointer to the clipboard format of the object. + /// Pointer to the default class, selected from the UI, to convert the object to. + /// + /// Address of a pointer variable that receives a pointer to an array of CLSIDs that should be excluded from the user interface + /// for this object. If lpcClsidExclude is zero, then lpClsidExclude is set to NULL. + /// + /// + /// Address of an output variable that receives the number of CLSIDs in lplpClsidExclude. This parameter may be zero. + /// + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Implementers + /// + /// You must fill in the CLSID of the object at a minimum. lpwFormat may be left at zero if the format of the storage is unknown. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuiobjinfoa-getconvertinfo HRESULT GetConvertInfo( + // DWORD dwObject, CLSID *lpClassID, WORD *lpwFormat, CLSID *lpConvertDefaultClassID, LPCLSID *lplpClsidExclude, UINT + // *lpcClsidExclude ); + [PreserveSig] + HRESULT GetConvertInfo(uint dwObject, out Guid lpClassID, out ushort lpwFormat, out Guid lpConvertDefaultClassID, + out IntPtr lplpClsidExclude, out uint lpcClsidExclude); + + /// Gets the size, type, name, and location information for an object. + /// Unique identifier for the object. + /// Pointer to the object's size, in bytes, on disk. This may be an approximate value. + /// + /// Address of a pointer variable that receives a pointer to the object's label string. This parameter may be NULL to + /// indicate that the implementation should not return the label string. + /// + /// + /// Address of a pointer variable that receives a pointer to the object's long type string. This parameter may be NULL to + /// indicate that the implementation should not return the long type string. + /// + /// + /// Address of a pointer variable that receives a pointer to the object's short type string. This parameter may be NULL + /// to indicate that the implementation should not return the short type string. + /// + /// + /// Address of a pointer variable that receives a pointer to the object's source location string. This parameter may be + /// NULL to indicate that the implementation should not return the location string. + /// + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// The strings and the object's size are displayed in the object properties General page. + /// Notes to Implementers + /// + /// Your implementation of GetObjectInfo should place each of the object's attributes in the out parameters provided. Set + /// lpdwObjSize to (DWORD)-1 when the size of the object is unknown. Allocate all strings (the rest of the params) with the OLE + /// task allocator obtained via CoGetMalloc, as is standard for all OLE interfaces with [out] string parameters, or you can + /// simply use CoTaskMemAlloc. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuiobjinfoa-getobjectinfo HRESULT GetObjectInfo( DWORD + // dwObject, DWORD *lpdwObjSize, LPSTR *lplpszLabel, LPSTR *lplpszType, LPSTR *lplpszShortType, LPSTR *lplpszLocation ); + [PreserveSig] + HRESULT GetObjectInfo(uint dwObject, out uint lpdwObjSize, [MarshalAs(UnmanagedType.LPStr)] out string lplpszLabel, + [MarshalAs(UnmanagedType.LPStr)] out string lplpszType, [MarshalAs(UnmanagedType.LPStr)] out string lplpszShortType, + [MarshalAs(UnmanagedType.LPStr)] out string lplpszLocation); + + /// Gets the view information associated with the object. + /// Unique identifier for the object. + /// + /// Pointer to the object's current icon. This parameter can be NULL, indicating that the caller is not interested in the + /// object's current presentation. + /// + /// + /// Pointer to the object's current aspect. This parameter can be NULL, indicating that the caller is not interested in + /// the object's current aspect, for example, DVASPECT_ICONIC or DVASPECT_CONTENT. + /// + /// + /// Pointer to the object's current scale. This parameter can be NULL, indicating that the caller is not interested in + /// the current scaling factor applied to the object in the container's view. + /// + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is not valid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Implementers + /// You must fill in the object's current icon, aspect, and scale. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuiobjinfoa-getviewinfo HRESULT GetViewInfo( DWORD + // dwObject, HGLOBAL *phMetaPict, DWORD *pdvAspect, int *pnCurrentScale ); + [PreserveSig] + HRESULT GetViewInfo(uint dwObject, [In, Optional] IntPtr phMetaPict, [In, Optional] IntPtr pdvAspect, [In, Optional] IntPtr pnCurrentScale); + + /// Sets the view information associated with the object. + /// Unique identifier for the object. + /// The new icon. + /// The new display aspect or view. + /// The new scale. + /// + /// The new scale of the object, relative to the origin. This value is TRUE if the scale should be relative to the + /// original scale of the object. If FALSE, nCurrentScale applies to the object's current size. + /// + /// + /// This method returns S_OK on success. Other possible return values include the following. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Insufficient access permissions. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// The specified identifier is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory available for this operation. + /// + /// + /// + /// + /// Notes to Implementers + /// + /// You should apply the new attributes (icon, aspect, and scale) to the object. If bRelativeToOrig is set to TRUE, + /// nCurrentScale (in percentage units) applies to the original size of the object before it was scaled. If bRelativeToOrig is + /// FALSE, nCurrentScale applies to the object's current size. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-ioleuiobjinfoa-setviewinfo HRESULT SetViewInfo( DWORD + // dwObject, HGLOBAL hMetaPict, DWORD dvAspect, int nCurrentScale, BOOL bRelativeToOrig ); + [PreserveSig] + HRESULT SetViewInfo(uint dwObject, HGLOBAL hMetaPict, DVASPECT dvAspect, int nCurrentScale, + [MarshalAs(UnmanagedType.Bool)] bool bRelativeToOrig); + } + + /// Adds the Verb menu for the specified object to the specified menu. + /// + /// Pointer to the IOleObject interface on the selected object. If this is NULL, then a default disabled menu item is created. + /// + /// + /// Pointer to the short name defined in the registry (AuxName==2) for the object identified with lpOleObj. If the string is not + /// known, then NULL may be passed. If NULL is passed, IOleObject::GetUserType is called to retrieve it. If the caller + /// has easy access to the string, it is faster to pass it in. + /// + /// Handle to the menu in which to make modifications. + /// Position of the menu item. + /// The identifier value at which to start the verbs. + /// + /// The maximum identifier value to be used for object verbs. If uIDVerbMax is 0, then no maximum identifier value is used. + /// + /// Indicates whether to add a Convert item to the bottom of the menu (preceded by a separator). + /// The identifier value to use for the Convert menu item, if bAddConvert is TRUE. + /// + /// An HMENU pointer to the cascading verb menu if it's created. If there is only one verb, this will be filled with NULL. + /// + /// + /// This function returns TRUE if lpOleObj was valid and at least one verb was added to the menu. A FALSE return + /// indicates that lpOleObj was NULL and a disabled default menu item was created. + /// + /// If the object has one verb, the verb is added directly to the given menu. + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-oleuiaddverbmenua BOOL OleUIAddVerbMenuA( LPOLEOBJECT + // lpOleObj, LPCSTR lpszShortType, HMENU hMenu, UINT uPos, UINT uIDVerbMin, UINT uIDVerbMax, BOOL bAddConvert, UINT idConvert, HMENU + // *lphMenu ); + [DllImport(Lib_OleDlg, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUIAddVerbMenuA")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool OleUIAddVerbMenu(IOleObject lpOleObj, [MarshalAs(UnmanagedType.LPTStr)] string lpszShortType, HMENU hMenu, uint uPos, uint uIDVerbMin, uint uIDVerbMax, + [MarshalAs(UnmanagedType.Bool)] bool bAddConvert, uint idConvert, out HMENU lphMenu); + /// Invokes the standard Busy dialog box, allowing the user to manage concurrency. /// Pointer to an OLEUIBUSY structure that contains information used to initialize the dialog box. /// @@ -327,6 +1256,31 @@ namespace Vanara.PInvoke [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUIBusyA")] public static extern uint OleUIBusy(ref OLEUIBUSY Arg1); + /// + /// Determines if there are any OLE object classes in the registry that can be used to convert or activate the specified CLSID from. + /// + /// The CLSID of the class for which the information is required. + /// TRUE if the original object is a linked object; FALSE otherwise. + /// Format of the original class. + /// This function returns TRUE if the specified class can be converted to another class; FALSE otherwise. + /// + /// + /// OleUICanConvertOrActivateAs searches the registry for classes that include wFormat in their \Conversion\Readable\Main, + /// \Conversion\ReadWriteable\Main, and \DataFormats\DefaultFile entries. + /// + /// + /// This function is useful for determining if a Convert... menu item should be disabled. If the CF_DISABLEDISPLAYASICON flag + /// is specified in the call to OleUIConvert, then the Convert... menu item should be enabled only if + /// OleUICanConvertOrActivateAs returns TRUE. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-oleuicanconvertoractivateas BOOL OleUICanConvertOrActivateAs( + // REFCLSID rClsid, BOOL fIsLinkedObject, WORD wFormat ); + [DllImport(Lib_OleDlg, SetLastError = false, ExactSpelling = true)] + [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUICanConvertOrActivateAs")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool OleUICanConvertOrActivateAs(in Guid rClsid, [MarshalAs(UnmanagedType.Bool)] bool fIsLinkedObject, ushort wFormat); + /// /// Invokes the standard Change Icon dialog box, which allows the user to select an icon from an icon file, executable, or DLL. /// @@ -634,6 +1588,1069 @@ namespace Vanara.PInvoke [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUIChangeSourceA")] public static extern uint OleUIChangeSource(ref OLEUICHANGESOURCE Arg1); + /// + /// Invokes the standard Convert dialog box, allowing the user to change the type of a single specified object, or the type + /// of all OLE objects of the specified object's class. + /// + /// Pointer to an OLEUICONVERT structure that contains information used to initialize the dialog box. + /// + /// Standard Success/Error Definitions + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_FALSE + /// Unknown failure (unused). + /// + /// + /// OLEUI_OK + /// The user pressed the OK button. + /// + /// + /// OLEUI_SUCCESS + /// No error, same as OLEUI_OK. + /// + /// + /// OLEUI_CANCEL + /// The user pressed the Cancel button. + /// + /// + /// Standard Field Validation Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMIN + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// OLEUI_ERR_STRUCTURENULL + /// The pointer to an OLEUIXXX structure passed into the function was NULL. + /// + /// + /// OLEUI_ERR_STRUCTUREINVALID + /// Insufficient permissions for read or write access to an OLEUIXXX structure. + /// + /// + /// OLEUI_ERR_CBSTRUCTINCORRECT + /// The cbstruct value is incorrect. + /// + /// + /// OLEUI_ERR_HWNDOWNERINVALID + /// The hWndOwner value is invalid. + /// + /// + /// OLEUI_ERR_LPSZCAPTIONINVALID + /// The lpszCaption value is invalid. + /// + /// + /// OLEUI_ERR_LPFNHOOKINVALID + /// The lpfnHook value is invalid. + /// + /// + /// OLEUI_ERR_HINSTANCEINVALID + /// The hInstance value is invalid. + /// + /// + /// OLEUI_ERR_LPSZTEMPLATEINVALID + /// The lpszTemplate value is invalid. + /// + /// + /// OLEUI_ERR_HRESOURCEINVALID + /// The hResource value is invalid. + /// + /// + /// Initialization Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_FINDTEMPLATEFAILURE + /// Unable to find the dialog box template. + /// + /// + /// OLEUI_ERR_LOADTEMPLATEFAILURE + /// Unable to load the dialog box template. + /// + /// + /// OLEUI_ERR_DIALOGFAILURE + /// Dialog box initialization failed. + /// + /// + /// OLEUI_ERR_LOCALMEMALLOC + /// A call to LocalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_GLOBALMEMALLOC + /// A call to GlobalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_LOADSTRING + /// Unable to call LoadString for localized resources from the library. + /// + /// + /// OLEUI_ERR_OLEMEMALLOC + /// A call to the standard IMalloc allocator failed. + /// + /// + /// Function Specific Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMAX + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// OLEUI_CTERR_CLASSIDINVALID + /// A clsid value was invalid. + /// + /// + /// OLEUI_CTERR_DVASPECTINVALID + /// The dvAspect value was invalid. This member specifies the aspect of the object. + /// + /// + /// OLEUI_CTERR_CBFORMATINVALID + /// The wFormat value was invalid. This member specifies the data format of the object. + /// + /// + /// OLEUI_CTERR_STRINGINVALID + /// A string value (for example, lpszUserType or lpszDefLabel) was invalid. + /// + /// + /// + /// + /// + /// OleUIConvert populates the Convert dialog box's list box with object classes by traversing the registry and + /// looking for entries in the Readable and ReadWritable keys. Every class that includes the original class' default file format in + /// its Readable key is added to the Convert list, and every class that includes the original class' default file format in its + /// ReadWritable key is added to the Activate As list. The Convert list is shown in the dialog box's list box when the + /// Convert radio button is selected (the default selection), and the Activate As list is shown when Activate As is selected. + /// + /// Note that you can change the type of all objects of a given class only when CF_CONVERTONLY is not specified. + /// + /// The convert command, which invokes this function, should only be made available to the user if OleUICanConvertOrActivateAs + /// returns S_OK. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-oleuiconverta UINT OleUIConvertA( LPOLEUICONVERTA Arg1 ); + [DllImport(Lib_OleDlg, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUIConvertA")] + public static extern uint OleUIConvert(in OLEUICONVERT Arg1); + + /// Invokes the standard Links dialog box, allowing the user to make modifications to a container's linked objects. + /// Pointer to an OLEUIEDITLINKS structure that contains information used to initialize the dialog box. + /// + /// Standard Success/Error Definitions + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_FALSE + /// Unknown failure (unused). + /// + /// + /// OLEUI_OK + /// The user pressed the OK button. + /// + /// + /// OLEUI_SUCCESS + /// No error, same as OLEUI_OK. + /// + /// + /// OLEUI_CANCEL + /// The user pressed the Cancel button. + /// + /// + /// Standard Field Validation Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMIN + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// OLEUI_ERR_STRUCTURENULL + /// The pointer to an OLEUIXXX structure passed into the function was NULL. + /// + /// + /// OLEUI_ERR_STRUCTUREINVALID + /// Insufficient permissions for read or write access to an OLEUIXXX structure. + /// + /// + /// OLEUI_ERR_CBSTRUCTINCORRECT + /// The cbstruct value is incorrect. + /// + /// + /// OLEUI_ERR_HWNDOWNERINVALID + /// The hWndOwner value is invalid. + /// + /// + /// OLEUI_ERR_LPSZCAPTIONINVALID + /// The lpszCaption value is invalid. + /// + /// + /// OLEUI_ERR_LPFNHOOKINVALID + /// The lpfnHook value is invalid. + /// + /// + /// OLEUI_ERR_HINSTANCEINVALID + /// The hInstance value is invalid. + /// + /// + /// OLEUI_ERR_LPSZTEMPLATEINVALID + /// The lpszTemplate value is invalid. + /// + /// + /// OLEUI_ERR_HRESOURCEINVALID + /// The hResource value is invalid. + /// + /// + /// Initialization Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_FINDTEMPLATEFAILURE + /// Unable to find the dialog box template. + /// + /// + /// OLEUI_ERR_LOADTEMPLATEFAILURE + /// Unable to load the dialog box template. + /// + /// + /// OLEUI_ERR_DIALOGFAILURE + /// Dialog box initialization failed. + /// + /// + /// OLEUI_ERR_LOCALMEMALLOC + /// A call to LocalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_GLOBALMEMALLOC + /// A call to GlobalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_LOADSTRING + /// Unable to call LoadString for localized resources from the library. + /// + /// + /// OLEUI_ERR_OLEMEMALLOC + /// A call to the standard IMalloc allocator failed. + /// + /// + /// Function Specific Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMAX + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-oleuieditlinksa UINT OleUIEditLinksA( LPOLEUIEDITLINKSA Arg1 ); + [DllImport(Lib_OleDlg, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUIEditLinksA")] + public static extern uint OleUIEditLinks(in OLEUIEDITLINKS Arg1); + + /// + /// Invokes the standard Insert Object dialog box, which allows the user to select an object source and class name, as well + /// as the option of displaying the object as itself or as an icon. + /// + /// Pointer to the in-out OLEUIINSERTOBJECT structure for this dialog box. + /// + /// Standard Success/Error Definitions + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_FALSE + /// Unknown failure (unused). + /// + /// + /// OLEUI_OK + /// The user pressed the OK button. + /// + /// + /// OLEUI_SUCCESS + /// No error, same as OLEUI_OK. + /// + /// + /// OLEUI_CANCEL + /// The user pressed the Cancel button. + /// + /// + /// Standard Field Validation Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMIN + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// OLEUI_ERR_STRUCTURENULL + /// The pointer to an OLEUIXXX structure passed into the function was NULL. + /// + /// + /// OLEUI_ERR_STRUCTUREINVALID + /// Insufficient permissions for read or write access to an OLEUIXXX structure. + /// + /// + /// OLEUI_ERR_CBSTRUCTINCORRECT + /// The cbstruct value is incorrect. + /// + /// + /// OLEUI_ERR_HWNDOWNERINVALID + /// The hWndOwner value is invalid. + /// + /// + /// OLEUI_ERR_LPSZCAPTIONINVALID + /// The lpszCaption value is invalid. + /// + /// + /// OLEUI_ERR_LPFNHOOKINVALID + /// The lpfnHook value is invalid. + /// + /// + /// OLEUI_ERR_HINSTANCEINVALID + /// The hInstance value is invalid. + /// + /// + /// OLEUI_ERR_LPSZTEMPLATEINVALID + /// The lpszTemplate value is invalid. + /// + /// + /// OLEUI_ERR_HRESOURCEINVALID + /// The hResource value is invalid. + /// + /// + /// Initialization Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_FINDTEMPLATEFAILURE + /// Unable to find the dialog box template. + /// + /// + /// OLEUI_ERR_LOADTEMPLATEFAILURE + /// Unable to load the dialog box template. + /// + /// + /// OLEUI_ERR_DIALOGFAILURE + /// Dialog box initialization failed. + /// + /// + /// OLEUI_ERR_LOCALMEMALLOC + /// A call to LocalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_GLOBALMEMALLOC + /// A call to GlobalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_LOADSTRING + /// Unable to call LoadString for localized resources from the library. + /// + /// + /// OLEUI_ERR_OLEMEMALLOC + /// A call to the standard IMalloc allocator failed. + /// + /// + /// Function Specific Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMAX + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// OLEUI_IOERR_LPSZFILEINVALID + /// + /// The lpszFile value is invalid or user has insufficient write access permissions.This lpszFile member points to the name of the + /// file linked to or inserted. + /// + /// + /// + /// OLEUI_IOERR_PPVOBJINVALID + /// The ppvOjb value is invalid. This member points to the location where the pointer for the object is returned. + /// + /// + /// OLEUI_IOERR_LPIOLECLIENTSITEINVALID + /// The lpIOleClientSite value is invalid. This member points to the client site for the object. + /// + /// + /// OLEUI_IOERR_LPISTORAGEINVALID + /// The lpIStorage value is invalid. This member points to the storage to be used for the object. + /// + /// + /// OLEUI_IOERR_SCODEHASERROR + /// The sc member of lpIO has additional error information. + /// + /// + /// OLEUI_IOERR_LPCLSIDEXCLUDEINVALID + /// The lpClsidExclude value is invalid. This member contains the list of CLSIDs to exclude. + /// + /// + /// OLEUI_IOERR_CCHFILEINVALID + /// + /// The cchFile or lpszFile value is invalid. The cchFile member specifies the size of the lpszFile buffer. The lpszFile member + /// points to the name of the file linked to or inserted. + /// + /// + /// + /// + /// + /// + /// OleUIInsertObject allows the user to select the type of object to be inserted from a list box containing the object + /// applications registered on the user's system. To populate that list box, OleUIInsertObject traverses the registry, adding + /// every object server it finds that meets the following criteria: + /// + /// + /// + /// The registry entry does not include the NotInsertable key. + /// + /// + /// The registry entry includes an OLE 1.0 style Protocol\\StdFileEditing\\Server key. + /// + /// + /// The registry entry includes the Insertable key. + /// + /// + /// The object's CLSID is not included in the list of objects to exclude (the lpClsidExclude member of OLEUIINSERTOBJECT). + /// + /// + /// + /// By default, OleUIInsertObject does not validate object servers, however, if the IOF_VERIFYSERVEREXIST flag is included in + /// the dwFlags member of the OLEUIINSERTOBJECT structure, OleUIInsertObject verifies that the server exists. If it does not + /// exist, then the server's object is not added to the list of available objects. Server validation is a time-extensive operation + /// and is a significant performance factor. + /// + /// + /// To free an HMETAFILEPICT returned from the Insert Object or Paste Special dialog box, delete the attached + /// metafile on the handle, as follows: + /// + /// + /// void FreeHmetafilepict(HMETAFILEPICT hmfp) { if (hmfp != NULL) { LPMETAFILEPICT pmfp = GlobalLock(hmfp); DeleteMetaFile(pmfp->hMF); GlobalUnlock(hmfp); GlobalFree(hmfp); } else { // Handle null pointers here. exit(0); } } + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-oleuiinsertobjecta UINT OleUIInsertObjectA( + // LPOLEUIINSERTOBJECTA Arg1 ); + [DllImport(Lib_OleDlg, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUIInsertObjectA")] + public static extern uint OleUIInsertObject(ref OLEUIINSERTOBJECT Arg1); + + /// + /// Invokes the Object Properties dialog box, which displays General, View, and Link information about + /// an object. + /// + /// Pointer to the OLEUIOBJECTPROPS structure. + /// + /// Standard Success/Error Definitions + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_FALSE + /// Unknown failure (unused). + /// + /// + /// OLEUI_OK + /// The user pressed the OK button. + /// + /// + /// OLEUI_SUCCESS + /// No error, same as OLEUI_OK. + /// + /// + /// OLEUI_CANCEL + /// The user pressed the Cancel button. + /// + /// + /// Standard Field Validation Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMIN + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// OLEUI_ERR_STRUCTURENULL + /// The pointer to an OLEUIXXX structure passed into the function was NULL. + /// + /// + /// OLEUI_ERR_STRUCTUREINVALID + /// Insufficient permissions for read or write access to an OLEUIXXX structure. + /// + /// + /// OLEUI_ERR_CBSTRUCTINCORRECT + /// The cbstruct value is incorrect. + /// + /// + /// OLEUI_ERR_HWNDOWNERINVALID + /// The hWndOwner value is invalid. + /// + /// + /// OLEUI_ERR_LPSZCAPTIONINVALID + /// The lpszCaption value is invalid. + /// + /// + /// OLEUI_ERR_LPFNHOOKINVALID + /// The lpfnHook value is invalid. + /// + /// + /// OLEUI_ERR_HINSTANCEINVALID + /// The hInstance value is invalid. + /// + /// + /// OLEUI_ERR_LPSZTEMPLATEINVALID + /// The lpszTemplate value is invalid. + /// + /// + /// OLEUI_ERR_HRESOURCEINVALID + /// The hResource value is invalid. + /// + /// + /// Initialization Errors + /// Initialization Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_FINDTEMPLATEFAILURE + /// Unable to find the dialog box template. + /// + /// + /// OLEUI_ERR_LOADTEMPLATEFAILURE + /// Unable to load the dialog box template. + /// + /// + /// OLEUI_ERR_DIALOGFAILURE + /// Dialog box initialization failed. + /// + /// + /// OLEUI_ERR_LOCALMEMALLOC + /// A call to LocalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_GLOBALMEMALLOC + /// A call to GlobalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_LOADSTRING + /// Unable to call LoadString for localized resources from the library. + /// + /// + /// OLEUI_ERR_OLEMEMALLOC + /// A call to the standard IMalloc allocator failed. + /// + /// + /// Function Specific Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMAX + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// OLEUI_OPERR_SUBPROPNULL + /// lpGP or lpVP is NULL, or dwFlags and OPF_OBJECTISLINK and lpLP are NULL. + /// + /// + /// OLEUI_OPERR_SUBPROPINVALID + /// Insufficient write-access permissions for the structures pointed to by lpGP, lpVP, or lpLP. + /// + /// + /// OLEUI_OPERR_PROPSHEETNULL + /// The lpLP value is NULL. + /// + /// + /// OLEUI_OPERR_PROPSHEETINVALID + /// Insufficient write-access permissions for the structures pointed to by lpGP, lpVP, or lpLP. + /// + /// + /// OLEUI_OPERR_SUPPROP + /// The sub-link property pointer, lpLP, is NULL. + /// + /// + /// OLEUI_OPERR_PROPSINVALID + /// Insufficient write access for the sub-link property pointer, lpLP. + /// + /// + /// OLEUI_OPERR_PAGESINCORRECT + /// Some sub-link properties of the lpPS member are incorrect. + /// + /// + /// OLEUI_OPERR_INVALIDPAGES + /// Some sub-link properties of the lpPS member are incorrect. + /// + /// + /// OLEUI_OPERR_NOTSUPPORTED + /// A sub-link property of the lpPS member is incorrect. + /// + /// + /// OLEUI_OPERR_DLGPROCNOTNULL + /// A sub-link property of the lpPS member is incorrect. + /// + /// + /// OLEUI_OPERR_LPARAMNOTZERO + /// A sub-link property of the lpPS member is incorrect. + /// + /// + /// OLEUI_GPERR_STRINGINVALID + /// A string value (for example, lplpszLabel or lplpszType) is invalid. + /// + /// + /// OLEUI_GPERR_CLASSIDINVALID + /// The clsid value is invalid. + /// + /// + /// OLEUI_GPERR_LPCLSIDEXCLUDEINVALID + /// The ClsidExcluded value is invalid. + /// + /// + /// OLEUI_GPERR_CBFORMATINVALID + /// The wFormat value is invalid. + /// + /// + /// OLEUI_VPERR_METAPICTINVALID + /// The hMetaPict value is invalid. + /// + /// + /// OLEUI_VPERR_DVASPECTINVALID + /// The dvAspect value is invalid. + /// + /// + /// OLEUI_OPERR_PROPERTYSHEET + /// The lpPS value is incorrect. + /// + /// + /// OLEUI_OPERR_OBJINFOINVALID + /// The lpObjInfo value is NULL or the calling process doesn't have read access. + /// + /// + /// OLEUI_OPERR_LINKINFOINVALID + /// The lpLinkInfo value is NULL or the calling process doesn't have read access. + /// + /// + /// + /// + /// OleUIObjectProperties is passed an OLEUIOBJECTPROPS structure, which supplies the information needed to fill in the + /// General, View, and Link tabs of the Object Properties dialog box. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-oleuiobjectpropertiesa UINT OleUIObjectPropertiesA( + // LPOLEUIOBJECTPROPSA Arg1 ); + [DllImport(Lib_OleDlg, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUIObjectPropertiesA")] + public static extern uint OleUIObjectProperties(ref OLEUIOBJECTPROPS Arg1); + + /// + /// Invokes the standard Paste Special dialog box, allowing the user to select the format of the clipboard object to be + /// pasted or paste-linked. + /// + /// A pointer to an OLEUIPASTESPECIAL structure. + /// + /// Standard Success/Error Definitions + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_FALSE + /// Unknown failure (unused). + /// + /// + /// OLEUI_OK + /// The user pressed the OK button. + /// + /// + /// OLEUI_SUCCESS + /// No error, same as OLEUI_OK. + /// + /// + /// OLEUI_CANCEL + /// The user pressed the Cancel button. + /// + /// + /// Standard Field Validation Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMIN + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// OLEUI_ERR_STRUCTURENULL + /// The pointer to an OLEUIXXX structure passed into the function was NULL. + /// + /// + /// OLEUI_ERR_STRUCTUREINVALID + /// Insufficient permissions for read or write access to an OLEUIXXX structure. + /// + /// + /// OLEUI_ERR_CBSTRUCTINCORRECT + /// The cbstruct value is incorrect. + /// + /// + /// OLEUI_ERR_HWNDOWNERINVALID + /// The hWndOwner value is invalid. + /// + /// + /// OLEUI_ERR_LPSZCAPTIONINVALID + /// The lpszCaption value is invalid. + /// + /// + /// OLEUI_ERR_LPFNHOOKINVALID + /// The lpfnHook value is invalid. + /// + /// + /// OLEUI_ERR_HINSTANCEINVALID + /// The hInstance value is invalid. + /// + /// + /// OLEUI_ERR_LPSZTEMPLATEINVALID + /// The lpszTemplate value is invalid. + /// + /// + /// OLEUI_ERR_HRESOURCEINVALID + /// The hResource value is invalid. + /// + /// + /// Initialization Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_FINDTEMPLATEFAILURE + /// Unable to find the dialog box template. + /// + /// + /// OLEUI_ERR_LOADTEMPLATEFAILURE + /// Unable to load the dialog box template. + /// + /// + /// OLEUI_ERR_DIALOGFAILURE + /// Dialog box initialization failed. + /// + /// + /// OLEUI_ERR_LOCALMEMALLOC + /// A call to LocalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_GLOBALMEMALLOC + /// A call to GlobalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_LOADSTRING + /// Unable to call LoadString to get localized resources from the library. + /// + /// + /// OLEUI_ERR_OLEMEMALLOC + /// A call to the standard IMalloc allocator failed. + /// + /// + /// Function Specific Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMAX + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// OLEUI_IOERR_SRCDATAOBJECTINVALID + /// The lpSrcDataObject member of OLEUIPASTESPECIAL is invalid. + /// + /// + /// OLEUI_IOERR_ARRPASTEENTRIESINVALID + /// The arrPasteEntries member of OLEUIPASTESPECIAL is invalid. + /// + /// + /// OLEUI_IOERR_ARRLINKTYPESINVALID + /// The arrLinkTypes member of OLEUIPASTESPECIAL is invalid. + /// + /// + /// OLEUI_PSERR_CLIPBOARDCHANGED + /// The clipboard contents changed while the dialog box was displayed. + /// + /// + /// OLEUI_PSERR_GETCLIPBOAARDFAILED + /// The lpSrcDataObj member is incorrect. + /// + /// + /// + /// + /// + /// The design of the Paste Special dialog box assumes that if you are willing to permit a user to link to an object, you are + /// also willing to permit the user to embed that object. For this reason, if any of the OLEUIPASTE_LINKTYPE flags associated with + /// the OLEUIPASTEFLAG enumeration are set, then the OLEUIPASTE_PASTE flag must also be set in order for the data formats to appear + /// in the Paste Special dialog box. + /// + /// + /// The text displayed in the Source field of the standard Paste Special dialog box, which is implemented in + /// Oledlg32.dll, is the null-terminated string whose offset in bytes is specified in the dwSrcofCopy member of the + /// OBJECTDESCRIPTOR structure for the object to be pasted. If an OBJECTDESCRIPTOR structure is not available for this + /// object, the dialog box displays whatever text may be associated with CF_LINKSOURCEDESCRIPTOR. If neither structure is available, + /// the dialog box looks for CF_FILENAME. If CF_FILENAME is not found, the dialog box displays the string "Unknown Source". + /// + /// + /// To free an HMETAFILEPICT returned from the Insert Object or Paste Special dialog box, delete the attached + /// metafile on the handle, as follows. + /// + /// + /// void FreeHmetafilepict(HMETAFILEPICT hmfp) { if (hmfp != NULL) { LPMETAFILEPICT pmfp = GlobalLock(hmfp); DeleteMetaFile(pmfp->hMF); GlobalUnlock(hmfp); GlobalFree(hmfp); } else { // Handle null pointers here. exit(0); } } // FreeHmetafilepict + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-oleuipastespeciala UINT OleUIPasteSpecialA( + // LPOLEUIPASTESPECIALA Arg1 ); + [DllImport(Lib_OleDlg, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUIPasteSpecialA")] + public static extern uint OleUIPasteSpecial(ref OLEUIPASTESPECIAL Arg1); + + /// + /// Displays a dialog box with the specified template and returns the response (button identifier) from the user. This function is + /// used to display OLE warning messages, for example, Class Not Registered. + /// + /// The resource number of the dialog box to be displayed. See Remarks. + /// The handle to the parent window of the dialog box. + /// + /// Optional. The title of the dialog box followed by a list of arguments for the format string in the static control (IDC_PU_TEXT) + /// of the dialog box. The caller must be sure to pass the correct number and types of arguments. + /// + /// + /// Standard Success/Error Definitions + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_FALSE + /// Unknown failure (unused). + /// + /// + /// OLEUI_OK + /// The user pressed the OK button. + /// + /// + /// OLEUI_SUCCESS + /// No error, same as OLEUI_OK. + /// + /// + /// OLEUI_CANCEL + /// The user pressed the Cancel button. + /// + /// + /// Standard Field Validation Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMIN + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// OLEUI_ERR_STRUCTURENULL + /// The pointer to an OLEUIXXX structure passed into the function was NULL. + /// + /// + /// OLEUI_ERR_STRUCTUREINVALID + /// Insufficient permissions for read or write access to an OLEUIXXX structure. + /// + /// + /// OLEUI_ERR_CBSTRUCTINCORRECT + /// The cbstruct value is incorrect. + /// + /// + /// OLEUI_ERR_HWNDOWNERINVALID + /// The hWndOwner value is invalid. + /// + /// + /// OLEUI_ERR_LPSZCAPTIONINVALID + /// The lpszCaption value is invalid. + /// + /// + /// OLEUI_ERR_LPFNHOOKINVALID + /// The lpfnHook value is invalid. + /// + /// + /// OLEUI_ERR_HINSTANCEINVALID + /// The hInstance value is invalid. + /// + /// + /// OLEUI_ERR_LPSZTEMPLATEINVALID + /// The lpszTemplate value is invalid. + /// + /// + /// OLEUI_ERR_HRESOURCEINVALID + /// The hResource value is invalid. + /// + /// + /// Initialization Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_FINDTEMPLATEFAILURE + /// Unable to find the dialog box template. + /// + /// + /// OLEUI_ERR_LOADTEMPLATEFAILURE + /// Unable to load the dialog box template. + /// + /// + /// OLEUI_ERR_DIALOGFAILURE + /// Dialog box initialization failed. + /// + /// + /// OLEUI_ERR_LOCALMEMALLOC + /// A call to LocalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_GLOBALMEMALLOC + /// A call to GlobalAlloc or the standard IMalloc allocator failed. + /// + /// + /// OLEUI_ERR_LOADSTRING + /// Unable to call LoadString for localized resources from the library. + /// + /// + /// OLEUI_ERR_OLEMEMALLOC + /// A call to the standard IMalloc allocator failed. + /// + /// + /// Function Specific Errors + /// + /// + /// Return code + /// Description + /// + /// + /// OLEUI_ERR_STANDARDMAX + /// + /// Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the + /// application to test for standard messages in order to display error messages to the user. + /// + /// + /// + /// + /// + /// + /// The following dialog box templates are defined in Windows Interface Guidelines--A Guide for Designing Software. The nTemplate + /// parameter must be a currently defined resource, however, additional templates can be added to prompt.dlg. + /// + /// + /// IDD_LINKSOURCEUNAVAILABLE IDD_CANNOTUPDATELINK IDD_SERVERNOTREG IDD_CANNOTRESPONDVERB IDD_SERVERNOTFOUND + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-oleuipromptusera int OleUIPromptUserA( int nTemplate, HWND + // hwndParent, ... ); + [DllImport(Lib_OleDlg, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUIPromptUserA")] + public static extern int OleUIPromptUser(int nTemplate, HWND hwndParent, IntPtr args); + + /// + /// Updates all links in the link container and displays a dialog box that shows the progress of the updating process. The process + /// is stopped if the user presses the Stop button or when all links are processed. + /// + /// Pointer to the IOleUILinkContainer interface on the link container. + /// Parent window of the dialog box. + /// Pointer to the title of the dialog box. + /// Total number of links. + /// Returns TRUE if the links were successfully updated; otherwise, FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/nf-oledlg-oleuiupdatelinksa BOOL OleUIUpdateLinksA( + // LPOLEUILINKCONTAINERA lpOleUILinkCntr, HWND hwndParent, LPSTR lpszTitle, int cLinks ); + [DllImport(Lib_OleDlg, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("oledlg.h", MSDNShortId = "NF:oledlg.OleUIUpdateLinksA")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool OleUIUpdateLinks(IOleUILinkContainer lpOleUILinkCntr, HWND hwndParent, [MarshalAs(UnmanagedType.LPTStr)] string lpszTitle, + int cLinks); + /// /// Contains information that the OLE User Interface Library uses to initialize the Busy dialog box, and space for the /// library to return information when the dialog box is dismissed. @@ -953,44 +2970,907 @@ namespace Vanara.PInvoke public string lpszTo; } - /* - OLEUICHANGESOURCEW - OLEUICONVERTA - OLEUICONVERTW - OLEUIEDITLINKSA - OLEUIEDITLINKSW - OLEUIGNRLPROPSA - OLEUIGNRLPROPSW - OLEUIINSERTOBJECTA - OLEUIINSERTOBJECTW - OLEUILINKPROPSA - OLEUILINKPROPSW - OLEUIOBJECTPROPSA - OLEUIOBJECTPROPSW - OLEUIPASTEENTRYA - OLEUIPASTEENTRYW - OLEUIPASTESPECIALA - OLEUIPASTESPECIALW - OLEUIVIEWPROPSA - OLEUIVIEWPROPSW + /// + /// Contains information that the OLE User Interface Library uses to initialize the Convert dialog box, and space for the + /// library to return information when the dialog box is dismissed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/ns-oledlg-oleuiconverta typedef struct tagOLEUICONVERTA { DWORD + // cbStruct; DWORD dwFlags; HWND hWndOwner; LPCSTR lpszCaption; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; HINSTANCE hInstance; + // LPCSTR lpszTemplate; HRSRC hResource; CLSID clsid; CLSID clsidConvertDefault; CLSID clsidActivateDefault; CLSID clsidNew; DWORD + // dvAspect; WORD wFormat; BOOL fIsLinkedObject; HGLOBAL hMetaPict; LPSTR lpszUserType; BOOL fObjectsIconChanged; LPSTR + // lpszDefLabel; UINT cClsidExclude; LPCLSID lpClsidExclude; } OLEUICONVERTA, *POLEUICONVERTA, *LPOLEUICONVERTA; + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUICONVERTA")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct OLEUICONVERT + { + /// The size of the structure, in bytes. This member must be filled on input. + public uint cbStruct; - OleUIAddVerbMenuA - OleUIAddVerbMenuW - OleUICanConvertOrActivateAs - OleUIConvertA - OleUIConvertW - OleUIEditLinksA - OleUIEditLinksW - OleUIInsertObjectA - OleUIInsertObjectW - OleUIObjectPropertiesA - OleUIObjectPropertiesW - OleUIPasteSpecialA - OleUIPasteSpecialW - OleUIPromptUserA - OleUIPromptUserW - OleUIUpdateLinksA - OleUIUpdateLinksW - */ + /// + /// + /// On input, this field specifies the initialization and creation flags. On exit, it specifies the user's choices. It may be a + /// combination of the following flags. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// CF_SHOWHELPBUTTON + /// Dialog box will display a Help button. This flag is set on input. + /// + /// + /// CF_SETCONVERTDEFAULT + /// + /// Class whose CLSID is specified by clsidConvertDefault will be used as the default selection. This selection appears in the + /// class listbox when the Convert To radio button is selected. This flag is set on input. + /// + /// + /// + /// CF_SETACTIVATEDEFAULT + /// + /// Class whose CLSID is specified by clsidActivateDefault will be used as the default selection. This selection appears in the + /// class listbox when the Activate As radio button is selected. This flag is set on input. + /// + /// + /// + /// CF_SELECTCONVERTTO + /// + /// On input, this flag specifies that Convert To will be initially selected (default behavior). This flag is set on output if + /// Convert To was selected when the user dismissed the dialog box. + /// + /// + /// + /// CF_SELECTACTIVATEAS + /// + /// On input, this flag specifies that Activate As will be initially selected. This flag is set on output if Activate As was + /// selected when the user dismissed the dialog box. + /// + /// + /// + /// CF_DISABLEDISPLAYASICON + /// The Display As Icon button will be disabled on initialization. + /// + /// + /// CF_DISABLEACTIVATEAS + /// The Activate As radio button will be disabled on initialization. + /// + /// + /// CF_HIDECHANGEICON + /// The Change Icon button will be hidden in the Convert dialog box. + /// + /// + /// CF_CONVERTONLY + /// The Activate As radio button will be disabled in the Convert dialog box. + /// + /// + /// + public CF dwFlags; + + /// The window that owns the dialog box. This member should not be NULL. + public HWND hWndOwner; + + /// Pointer to a string to be used as the title of the dialog box. If NULL, then the library uses Convert. + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszCaption; + + /// + /// Pointer to a hook function that processes messages intended for the dialog box. The hook function must return zero to pass a + /// message that it didn't process back to the dialog box procedure in the library. The hook function must return a nonzero + /// value to prevent the library's dialog box procedure from processing a message it has already processed. + /// + public LPFNOLEUIHOOK lpfnHook; + + /// + /// Application-defined data that the library passes to the hook function pointed to by the lpfnHook member. The library + /// passes a pointer to the OLEUICONVERT structure in the lParam parameter of the WM_INITDIALOG message; this pointer can + /// be used to retrieve the lCustData member. + /// + public IntPtr lCustData; + + /// + /// Instance that contains a dialog box template specified by the lpszTemplate member. This member is ignored if the + /// lpszTemplate member is NULL or invalid. + /// + public HINSTANCE hInstance; + + /// + /// Pointer to a null-terminated string that specifies the name of the resource file for the dialog box template that is to be + /// substituted for the library's Convert dialog box template. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszTemplate; + + /// + /// Resource handle for a custom dialog box. If this member is NULL, then the library uses the standard Convert + /// dialog box template, or if it is valid, the template named by the lpszTemplate member. + /// + public HRSRC hResource; + + /// The CLSID of the object to be converted or activated. This member is set on input. + public Guid clsid; + + /// + /// The CLSID to use as the default class when Convert To is selected. This member is ignored if the dwFlags + /// member does not include CF_SETCONVERTDEFAULT. This member is set on input. + /// + public Guid clsidConvertDefault; + + /// + /// The CLSID to use as the default class when Activate As is selected. This member is ignored if the dwFlags + /// member does not include CF_SETACTIVATEDEFAULT. This member is set on input. + /// + public Guid clsidActivateDefault; + + /// The CLSID of the selected class. This member is set on output. + public Guid clsidNew; + + /// + /// Aspect of the object. This must be either DVASPECT_CONTENT or DVASPECT_ICON. If dvAspect is DVASPECT_ICON on input, + /// then the Display As Icon box is checked and the object's icon is displayed. This member is set on input and output. + /// For more information, see DVASPECT. + /// + public DVASPECT dvAspect; + + /// Data format of the object to be converted or activated. + public ushort wFormat; + + /// TRUE if the object is linked. This member is set on input. + [MarshalAs(UnmanagedType.Bool)] + public bool fIsLinkedObject; + + /// The METAFILEPICT containing the iconic aspect. This member is set on input and output. + public HGLOBAL hMetaPict; + + /// + /// Pointer to the User Type name of the object to be converted or activated. If this value is NULL, then the dialog box + /// will retrieve the User Type name from the registry. This string is freed on exit. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszUserType; + + /// + /// TRUE if the object's icon changed. (that is, if OleUIChangeIcon was called and not canceled.). This member is set on output. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fObjectsIconChanged; + + /// + /// Pointer to the default label to use for the icon. If NULL, the short user type name will be used. If the object is a + /// link, the caller should pass the display name of the link source. This is freed on exit. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszDefLabel; + + /// Number of CLSIDs in lpClsidExclude. + public uint cClsidExclude; + + /// Pointer to the list of CLSIDs to exclude from the list. + public IntPtr lpClsidExclude; + } + + /// + /// Contains information that the OLE User Interface Library uses to initialize the Edit Links dialog box, and contains space + /// for the library to return information when the dialog box is dismissed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/ns-oledlg-oleuieditlinksa typedef struct tagOLEUIEDITLINKSA { DWORD + // cbStruct; DWORD dwFlags; HWND hWndOwner; LPCSTR lpszCaption; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; HINSTANCE hInstance; + // LPCSTR lpszTemplate; HRSRC hResource; LPOLEUILINKCONTAINERA lpOleUILinkContainer; } OLEUIEDITLINKSA, *POLEUIEDITLINKSA, *LPOLEUIEDITLINKSA; + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIEDITLINKSA")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct OLEUIEDITLINKS + { + /// The size of the structure, in bytes. This member must be filled on input. + public uint cbStruct; + + /// + /// + /// On input, dwFlags specifies the initialization and creation flags. It may be a combination of the following flags. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// ELF_SHOWHELP + /// Specifies that the dialog box will display a Help button. + /// + /// + /// ELF_DISABLEUPDATENOW + /// Specifies that the Update Now button will be disabled on initialization. + /// + /// + /// ELF_DISABLEOPENSOURCE + /// Specifies that the Open Source button will be disabled on initialization. + /// + /// + /// ELF_DISABLECHANGESOURCE + /// Specifies that the Change Source button will be disabled on initialization. + /// + /// + /// ELF_DISABLECANCELLINK + /// Specifies that the Cancel Link button will be disabled on initialization. + /// + /// + /// + public ELF dwFlags; + + /// The window that owns the dialog box. This member should not be NULL. + public HWND hWndOwner; + + /// Pointer to a string to be used as the title of the dialog box. If NULL, then the library uses Links. + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszCaption; + + /// + /// Pointer to a hook function that processes messages intended for the dialog box. The hook function must return zero to pass a + /// message that it didn't process back to the dialog box procedure in the library. The hook function must return a nonzero + /// value to prevent the library's dialog box procedure from processing a message it has already processed. + /// + public LPFNOLEUIHOOK lpfnHook; + + /// + /// Application-defined data that the library passes to the hook function pointed to by the lpfnHook member. The library + /// passes a pointer to the OLEUIEDITLINKS structure in the lParam parameter of the WM_INITDIALOG message; this pointer + /// can be used to retrieve the lCustData member. + /// + public IntPtr lCustData; + + /// Instance that contains a dialog box template specified by the lpTemplateName member. + public HINSTANCE hInstance; + + /// + /// Pointer to a null-terminated string that specifies the name of the resource file for the dialog box template that is to be + /// substituted for the library's Edit Links dialog box template. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszTemplate; + + /// Customized template handle. + public HRSRC hResource; + + /// + /// Pointer to the container's implementation of the IOleUILinkContainer Interface. The Edit Links dialog box uses this + /// to allow the container to manipulate its links. + /// + public IOleUILinkContainer lpOleUILinkContainer; + } + + /// + /// Initializes the General tab of the Object Properties dialog box. A reference to it is passed in as part of the + /// OLEUIOBJECTPROPS structure to the OleUIObjectProperties function. This tab shows the type and size of an OLE embedding and + /// allows it the user to tunnel to the Convert dialog box. This tab also shows the link destination if the object is a link. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/ns-oledlg-oleuignrlpropsa typedef struct tagOLEUIGNRLPROPSA { DWORD + // cbStruct; DWORD dwFlags; DWORD dwReserved1[2]; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; DWORD dwReserved2[3]; struct + // tagOLEUIOBJECTPROPSA *lpOP; } OLEUIGNRLPROPSA, *POLEUIGNRLPROPSA, *LPOLEUIGNRLPROPSA; + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIGNRLPROPSA")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct OLEUIGNRLPROPS + { + /// The size of the structure, in bytes. This field must be filled on input. + public uint cbStruct; + + /// Currently no flags associated with this member. It should be set to 0 (zero). + public uint dwFlags; + + /// This member is reserved. + public ulong dwReserved1; + + /// + /// Pointer to a hook function that processes messages intended for the dialog box. The hook function must return zero to pass a + /// message that it didn't process back to the dialog box procedure in the library. The hook function must return a nonzero + /// value to prevent the library's dialog box procedure from processing a message it has already processed. + /// + public LPFNOLEUIHOOK lpfnHook; + + /// + /// Application-defined data that the library passes to the hook function pointed to by the lpfnHook member during WM_INITDIALOG. + /// + public IntPtr lCustData; + + /// This member is reserved. + public uint dwReserved2_1; + + /// This member is reserved. + public uint dwReserved2_2; + + /// This member is reserved. + public uint dwReserved2_3; + + /// Used internally. + public IntPtr lpOP; + } + + /// + /// Contains information that the OLE User Interface Library uses to initialize the Insert Object dialog box, and space for + /// the library to return information when the dialog box is dismissed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/ns-oledlg-oleuiinsertobjecta typedef struct tagOLEUIINSERTOBJECTA { + // DWORD cbStruct; DWORD dwFlags; HWND hWndOwner; LPCSTR lpszCaption; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; HINSTANCE hInstance; + // LPCSTR lpszTemplate; HRSRC hResource; CLSID clsid; LPSTR lpszFile; UINT cchFile; UINT cClsidExclude; LPCLSID lpClsidExclude; IID + // iid; DWORD oleRender; LPFORMATETC lpFormatEtc; LPOLECLIENTSITE lpIOleClientSite; LPSTORAGE lpIStorage; LPVOID *ppvObj; SCODE sc; + // HGLOBAL hMetaPict; } OLEUIINSERTOBJECTA, *POLEUIINSERTOBJECTA, *LPOLEUIINSERTOBJECTA; + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIINSERTOBJECTA")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct OLEUIINSERTOBJECT + { + /// The size of the structure, in bytes. This field must be filled on input. + public uint cbStruct; + + /// + /// + /// On input, specifies the initialization and creation flags. On exit, specifies the user's choices. It can be a combination of + /// the following flags. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// IOF_SHOWHELP + /// The dialog box will display a Help button. + /// + /// + /// IOF_SELECTCREATENEW + /// The Create New radio button will initially be checked. This cannot be used with IOF_SELECTCREATEFROMFILE. + /// + /// + /// IOF_SELECTCREATEFROMFILE + /// The Create From File radio button will initially be checked. This cannot be used with IOF_SELECTCREATENEW. + /// + /// + /// IOF_CHECKLINK + /// The Link check box will initially be checked. + /// + /// + /// IOF_CHECKDISPLAYASICON + /// + /// The Display As Icon check box will initially be checked, the current icon will be displayed, and the Change Icon button will + /// be enabled. + /// + /// + /// + /// IOF_CREATENEWOBJECT + /// + /// A new object should be created when the user selects OK to dismiss the dialog box and the Create New radio button was selected. + /// + /// + /// + /// IOF_CREATEFILEOBJECT + /// + /// A new object should be created from the specified file when the user selects OK to dismiss the dialog box and the Create + /// From File radio button was selected. + /// + /// + /// + /// IOF_CREATELINKOBJECT + /// + /// A new linked object should be created when the user selects OK to dismiss the dialog box and the user checked the Link check box. + /// + /// + /// + /// IOF_DISABLELINK + /// The Link check box will be disabled on initialization. + /// + /// + /// IOF_VERIFYSERVERSEXIST + /// + /// The dialog box should validate the classes it adds to the listbox by ensuring that the server specified in the registration + /// database exists. This is a significant performance factor. + /// + /// + /// + /// IOF_DISABLEDISPLAYASICON + /// The Display As Icon check box will be disabled on initialization. + /// + /// + /// IOF_HIDECHANGEICON + /// The Change Icon button will be hidden in the Insert Object dialog box. + /// + /// + /// IOF_SHOWINSERTCONTROL + /// Displays the Insert Control radio button. + /// + /// + /// IOF_SELECTCREATECONTROL + /// Displays the Create Control radio button. + /// + /// + /// + public IOF dwFlags; + + /// The window that owns the dialog box. This member should not be NULL. + public HWND hWndOwner; + + /// + /// Pointer to a string to be used as the title of the dialog box. If NULL, then the library uses Insert Object. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszCaption; + + /// + /// Pointer to a hook function that processes messages intended for the dialog box. The hook function must return zero to pass a + /// message that it didn't process back to the dialog box procedure in the library. The hook function must return a nonzero + /// value to prevent the library's dialog box procedure from processing a message it has already processed. + /// + public LPFNOLEUIHOOK lpfnHook; + + /// + /// Application-defined data that the library passes to the hook function pointed to by the lpfnHook member. The library + /// passes a pointer to the OLEUIINSERTOBJECT structure in the lParam parameter of the WM_INITDIALOG message; this + /// pointer can be used to retrieve the lCustData member. + /// + public IntPtr lCustData; + + /// Instance that contains a dialog box template specified by the lpTemplateName member. + public HINSTANCE hInstance; + + /// + /// Pointer to a null-terminated string that specifies the name of the resource file for the dialog box template that is to be + /// substituted for the library's Insert Object dialog box template. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszTemplate; + + /// Customized template handle. + public HRSRC hResource; + + /// CLSID for class of the object to be inserted. Filled on output. + public Guid clsid; + + /// Pointer to the name of the file to be linked or embedded. Filled on output. + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszFile; + + /// Size of lpszFile buffer; will not exceed MAX_PATH. + public uint cchFile; + + /// Number of CLSIDs included in the lpClsidExclude list. Filled on input. + public uint cClsidExclude; + + /// Pointer to a list of CLSIDs to exclude from listing. + public IntPtr lpClsidExclude; + + /// + /// Identifier of the requested interface. If OleUIInsertObject creates the object, then it will return a pointer to this + /// interface. This parameter is ignored if OleUIInsertObject does not create the object. + /// + public Guid iid; + + /// + /// Rendering option. If OleUIInsertObject creates the object, then it selects the rendering option when it creates the object. + /// This parameter is ignored if OleUIInsertObject does not create the object. + /// + public uint oleRender; + + /// + /// Desired format. If OleUIInsertObject creates the object, then it selects the format when it creates the object. This + /// parameter is ignored if OleUIInsertObject does not create the object. + /// + public IntPtr lpFormatEtc; + + /// + /// Pointer to the client site to be used for the object. This parameter is ignored if OleUIInsertObject does not create the object. + /// + public IOleClientSite lpIOleClientSite; + + /// + /// Pointer to the storage to be used for the object. This parameter is ignored if OleUIInsertObject does not create the object. + /// + public IStorage lpIStorage; + + /// + /// Address of output pointer variable that contains the interface pointer for the object being inserted. This parameter is + /// ignored if OleUIInsertObject does not create the object. + /// + public IntPtr ppvObj; + + /// Result of creation calls. This parameter is ignored if OleUIInsertObject does not create the object. + public int sc; + + /// MetafilePict structure containing the iconic aspect, if it wasn't placed in the object's cache. + public HGLOBAL hMetaPict; + } + + /// + /// Contains information that is used to initialize the Link tab of the Object Properties dialog box. A reference to + /// it is passed in as part of the OLEUIOBJECTPROPS structure to the OleUIObjectProperties function. This tab shows the location, + /// update status, and update time for a link. It allows the user to change the source of the link, toggle its update status between + /// automatic and manual update, open the source, force an update of the link, or break the link (convert it to a static picture). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/ns-oledlg-oleuilinkpropsa typedef struct tagOLEUILINKPROPSA { DWORD + // cbStruct; DWORD dwFlags; DWORD dwReserved1[2]; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; DWORD dwReserved2[3]; struct + // tagOLEUIOBJECTPROPSA *lpOP; } OLEUILINKPROPSA, *POLEUILINKPROPSA, *LPOLEUILINKPROPSA; + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUILINKPROPSA")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct OLEUILINKPROPS + { + /// The size of the structure, in bytes. + public uint cbStruct; + + /// Contains in/out flags specific to the Links page. + public uint dwFlags; + + /// This member is reserved. + public ulong dwReserved1; + + /// Pointer to the hook callback (not used in this dialog box). + public LPFNOLEUIHOOK lpfnHook; + + /// Custom data to pass to hook (not used in this dialog box). + public IntPtr lCustData; + + /// This member is reserved. + public uint dwReserved2_1; + + /// This member is reserved. + public uint dwReserved2_2; + + /// This member is reserved. + public uint dwReserved2_3; + + /// Used internally. + public IntPtr lpOP; + } + + /// + /// Contains information that is used to initialize the standard Object Properties dialog box. It contains references to + /// interfaces used to gather information about the embedding or link, references to three structures that are used to initialize + /// the default tabs - General (OLEUIGNRLPROPS), View (OLEUIVIEWPROPS), and Link (OLEUILINKPROPS), if + /// appropriate - and a standard property-sheet extensibility interface that allows the caller to add additional custom property + /// sheets to the dialog box. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/ns-oledlg-oleuiobjectpropsa typedef struct tagOLEUIOBJECTPROPSA { DWORD + // cbStruct; DWORD dwFlags; LPPROPSHEETHEADERA lpPS; DWORD dwObject; LPOLEUIOBJINFOA lpObjInfo; DWORD dwLink; LPOLEUILINKINFOA + // lpLinkInfo; LPOLEUIGNRLPROPSA lpGP; LPOLEUIVIEWPROPSA lpVP; LPOLEUILINKPROPSA lpLP; } OLEUIOBJECTPROPSA, *POLEUIOBJECTPROPSA, *LPOLEUIOBJECTPROPSA; + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIOBJECTPROPSA")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct OLEUIOBJECTPROPS + { + /// The size of the structure, in bytes. + public uint cbStruct; + + /// + /// Contains in/out global flags for the property sheet. + /// + /// + /// Value + /// Meaning + /// + /// + /// OPF_OBJECTISLINK + /// Object is a link object and therefore has a link property page. + /// + /// + /// OPF_NOFILLDEFAULT + /// Do not fill in default values for the object. + /// + /// + /// OPF_SHOWHELP + /// The dialog box will display a Help button. + /// + /// + /// OPF_DISABLECONVERT + /// The Convert button will be disabled on the general property page. + /// + /// + /// + public OPF dwFlags; + + /// Pointer to the standard property sheet header (PROPSHEETHEADER in ComCtl32), used for extensibility. + public IntPtr lpPS; + + /// Identifier for the object. + public uint dwObject; + + /// Pointer to the interface to manipulate object. + public IOleUIObjInfo lpObjInfo; + + /// + /// Container-defined unique identifier for a single link. Containers can use the pointer to the link's container site for this value. + /// + public uint dwLink; + + /// Pointer to the interface to manipulate link. + public IOleUILinkInfo lpLinkInfo; + + /// Pointer to the general page data in . + public IntPtr lpGP; + + /// Pointer to the view page data in . + public IntPtr lpVP; + + /// Pointer to the link page data in . + public IntPtr lpLP; + } + + /// + /// An array of entries to be specified in the OLEUIPASTESPECIAL structure for the Paste Special dialog box. Each entry + /// includes a FORMATETC structure which specifies the formats that are acceptable, a string that is to represent the format in the + /// dialog box's listbox, a string to customize the result text of the dialog box, and a set of flags from the OLEUIPASTEFLAG + /// enumeration. The flags indicate if the entry is valid for pasting only, linking only or both pasting and linking. If the entry + /// is valid for linking, the flags indicate which link types are acceptable by OR'ing together the appropriate OLEUIPASTE_LINKTYPEn values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/ns-oledlg-oleuipasteentrya typedef struct tagOLEUIPASTEENTRYA { + // FORMATETC fmtetc; LPCSTR lpstrFormatName; LPCSTR lpstrResultText; DWORD dwFlags; DWORD dwScratchSpace; } OLEUIPASTEENTRYA, + // *POLEUIPASTEENTRYA, *LPOLEUIPASTEENTRYA; + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIPASTEENTRYA")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct OLEUIPASTEENTRY + { + /// + /// Format that is acceptable. The Paste Special dialog box checks if this format is offered by the object on the + /// clipboard and if so, offers it for selection to the user. + /// + public FORMATETC fmtetc; + + /// + /// Pointer to the string that represents the format to the user. Any %s in this string is replaced by the FullUserTypeName of + /// the object on the clipboard and the resulting string is placed in the list box of the dialog box. Only one %s is allowed. + /// The presence or absence of %s specifies whether the result-text is to indicate that data is being pasted or that an object + /// that can be activated by an application is being pasted. If %s is present, the resulting text says that an object is being + /// pasted. Otherwise, it says that data is being pasted. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpstrFormatName; + + /// + /// Pointer to the string used to customize the resulting text of the dialog box when the user selects the format corresponding + /// to this entry. Any %s in this string is replaced by the application name or FullUserTypeName of the object on the clipboard. + /// Only one %s is allowed. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpstrResultText; + + /// Values from OLEUIPASTEFLAG enumeration. + public OLEUIPASTEFLAG dwFlags; + + /// + /// Scratch space available to routines that loop through an IEnumFORMATETC to mark if the PasteEntry format is available. This + /// field can be left uninitialized. + /// + public uint dwScratchSpace; + } + + /// + /// Contains information that the OLE User Interface Library uses to initialize the Paste Special dialog box, as well as + /// space for the library to return information when the dialog box is dismissed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/ns-oledlg-oleuipastespeciala typedef struct tagOLEUIPASTESPECIALA { + // DWORD cbStruct; DWORD dwFlags; HWND hWndOwner; LPCSTR lpszCaption; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; HINSTANCE hInstance; + // LPCSTR lpszTemplate; HRSRC hResource; LPDATAOBJECT lpSrcDataObj; LPOLEUIPASTEENTRYA arrPasteEntries; int cPasteEntries; UINT + // *arrLinkTypes; int cLinkTypes; UINT cClsidExclude; LPCLSID lpClsidExclude; int nSelectedIndex; BOOL fLink; HGLOBAL hMetaPict; + // SIZEL sizel; } OLEUIPASTESPECIALA, *POLEUIPASTESPECIALA, *LPOLEUIPASTESPECIALA; + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIPASTESPECIALA")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct OLEUIPASTESPECIAL + { + /// The size of the structure, in bytes. This member must be filled on input. + public uint cbStruct; + + /// + /// + /// On input, dwFlags specifies the initialization and creation flags. On exit, it specifies the user's choices. It may + /// be a combination of the following flags. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// PSF_SHOWHELP + /// Dialog box will display a Help button. + /// + /// + /// PSF_SELECTPASTE + /// + /// The Paste radio button will be selected at dialog box startup. This is the default, if PSF_SELECTPASTE or + /// PSF_SELECTPASTELINK are not specified. Also, it specifies the state of the button on dialog termination. IN/OUT flag. + /// + /// + /// + /// PSF_SELECTPASTELINK + /// + /// The PasteLink radio button will be selected at dialog box startup. Also, specifies the state of the button on dialog + /// termination. IN/OUT flag. + /// + /// + /// + /// PSF_CHECKDISPLAYASICON + /// Whether the Display As Icon radio button was checked on dialog box termination. OUT flag. + /// + /// + /// PSF_DISABLEDISPLAYASICON + /// The Display As Icon check box will be disabled on initialization. + /// + /// + /// HIDECHANGEICON + /// + /// Used to disable the change-icon button in the dialog box, which is available to users when they're pasting an OLE object by + /// default. See STAYONCLIPBOARDCHANGE otherwise. + /// + /// + /// + /// STAYONCLIPBOARDCHANGE + /// + /// Used to tell the dialog box to stay up if the clipboard changes while the dialog box is up. If the user switches to another + /// application and copies or cuts something, the dialog box will, by default, perform a cancel operation, which will remove the + /// dialog box since the options it's in the middle of presenting to the user are no longer up-to-date with respect to what's + /// really on the clipboard. + /// + /// + /// + /// NOREFRESHDATAOBJECT + /// + /// Used in conjunction with STAYONCLIPBOARDCHANGE (it doesn't do anything otherwise). If the clipboard changes while the dialog + /// box is up and STAYONCLIPBOARDCHANGE is specified, then NOREFRESHDATAOBJECT indicates that the dialog box should NOT refresh + /// the contents of the dialog box to reflect the new contents of the clipboard. This is useful if the application is using the + /// paste-special dialog box on an IDataObject besides the one on the clipboard, for example, as part of a right-click + /// drag-and-drop operation. + /// + /// + /// + /// + public PSF dwFlags; + + /// The window that owns the dialog box. This member should not be NULL. + public HWND hWndOwner; + + /// + /// Pointer to a string to be used as the title of the dialog box. If NULL, then the library uses Paste Special. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszCaption; + + /// + /// Pointer to a hook function that processes messages intended for the dialog box. The hook function must return zero to pass a + /// message that it didn't process back to the dialog box procedure in the library. The hook function must return a nonzero + /// value to prevent the library's dialog box procedure from processing a message it has already processed. + /// + public LPFNOLEUIHOOK lpfnHook; + + /// + /// Application-defined data that the library passes to the hook function pointed to by the lpfnHook member. The library + /// passes a pointer to the OLEUIPASTESPECIAL structure in the lParam parameter of the WM_INITDIALOG message; this + /// pointer can be used to retrieve the lCustData member. + /// + public IntPtr lCustData; + + /// Instance that contains a dialog box template specified by the lpTemplateName member. + public HINSTANCE hInstance; + + /// + /// Pointer to a null-terminated string that specifies the name of the resource file for the dialog box template that is to be + /// substituted for the library's Paste Special dialog box template. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszTemplate; + + /// Customized template handle. + public HRSRC hResource; + + /// + /// Pointer to the IDataObject interface of the data object to be pasted (from the clipboard). This member is filled on input. + /// If lpSrcDataObj is NULL when OleUIPasteSpecial is called, then OleUIPasteSpecial will attempt to + /// retrieve a pointer to an IDataObject from the clipboard. If OleUIPasteSpecial succeeds, it is the caller's + /// responsibility to free the IDataObject returned in lpSrcDataObj. + /// + public IDataObject lpSrcDataObj; + + /// The array which specifies acceptable formats. This member is filled on input. + public IntPtr arrPasteEntries; + + /// Number of OLEUIPASTEENTRY array entries. This member is filled on input. + public int cPasteEntries; + + /// + /// List of link types that are acceptable. Link types are referred to using OLEUIPASTEFLAG in arrPasteEntries. This + /// member is filled on input. + /// + public IntPtr arrLinkTypes; + + /// Number of link types. This member is filled on input. + public int cLinkTypes; + + /// Number of CLSIDs in lpClsidExclude. This member is filled on input. + public uint cClsidExclude; + + /// + /// Pointer to an array of CLSIDs to exclude from the list of available server objects for a Paste operation. Note that this + /// does not affect Paste Link. An application can prevent embedding into itself by listing its own CLSID in this list. + /// This field is filled on input. + /// + public IntPtr lpClsidExclude; + + /// Index of arrPasteEntries that the user selected. This member is filled on output. + public int nSelectedIndex; + + /// Whether Paste or Paste Link was selected by the user. This member is filled on output. + [MarshalAs(UnmanagedType.Bool)] + public bool fLink; + + /// Handle to the Metafile containing the icon and icon title selected by the user. This member is filled on output. + public HGLOBAL hMetaPict; + + /// + /// The size of object as displayed in its source, if the display aspect chosen by the user matches the aspect displayed in the + /// source. If the user chooses a different aspect, then sizel.cx and sizel.cy are both set to zero. The size of + /// the object as it is displayed in the source is retrieved from the ObjectDescriptor if fLink is FALSE and from + /// the LinkSrcDescriptor if fLink is TRUE. This member is filled on output. + /// + public SIZE sizel; + } + + /// + /// Contains information that is used to initialize the View tab of the Object properties dialog box. A reference to + /// it is passed in as part of the OLEUIOBJECTPROPS structure to the OleUIObjectProperties function. This tab allows the user to + /// toggle between "content" and "iconic" views of the object, and change its scaling within the container. It also allows the user + /// to tunnel to the change icon dialog box when the object is being displayed iconically. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/oledlg/ns-oledlg-oleuiviewpropsa typedef struct tagOLEUIVIEWPROPSA { DWORD + // cbStruct; DWORD dwFlags; DWORD dwReserved1[2]; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; DWORD dwReserved2[3]; struct + // tagOLEUIOBJECTPROPSA *lpOP; int nScaleMin; int nScaleMax; } OLEUIVIEWPROPSA, *POLEUIVIEWPROPSA, *LPOLEUIVIEWPROPSA; + [PInvokeData("oledlg.h", MSDNShortId = "NS:oledlg.tagOLEUIVIEWPROPSA")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct OLEUIVIEWPROPS + { + /// The size of the structure, in bytes. + public uint cbStruct; + + /// + /// Flags specific to view page. + /// + /// + /// Value + /// Meaning + /// + /// + /// VPF_SELECTRELATIVE + /// Relative to origin. + /// + /// + /// VPF_DISABLERELATIVE + /// Disable relative to origin. + /// + /// + /// VPF_DISABLESCALE + /// Disable scale option. + /// + /// + /// + public VPF dwFlags; + + /// This member is reserved. + public ulong dwReserved1; + + /// Pointer to a hook callback (not used in this dialog box). + public LPFNOLEUIHOOK lpfnHook; + + /// Custom data to pass to the hook (not used in this dialog box). + public IntPtr lCustData; + + /// This member is reserved. + public uint dwReserved2_1; + + /// This member is reserved. + public uint dwReserved2_2; + + /// This member is reserved. + public uint dwReserved2_3; + + /// Used internally. + public IntPtr lpOP; + + /// Minimum value for the scale range. + public int nScaleMin; + + /// Maximum value for the scale range. + public int nScaleMax; + } } } \ No newline at end of file diff --git a/PInvoke/OleDlg/Vanara.PInvoke.OleDlg.csproj b/PInvoke/OleDlg/Vanara.PInvoke.OleDlg.csproj index 220c52b3..31c7caf5 100644 --- a/PInvoke/OleDlg/Vanara.PInvoke.OleDlg.csproj +++ b/PInvoke/OleDlg/Vanara.PInvoke.OleDlg.csproj @@ -24,6 +24,7 @@ OLEUIBUSY, OLEUICHANGEICON, OLEUICHANGESOURCE + \ No newline at end of file