Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

IPersistFile (Interfaces)
 
.
Summary
IPersistFile

The IPersistFile interface provides methods that permit an object to be loaded from or saved to a disk file, rather than a storage object or stream. Because the information needed to open a file varies greatly from one application to another, the implementation of IPersistFile::Load on the object must also open its disk file.

The IPersistFile interface inherits its definition from IPersist, so all implementations must also include the GetClassID method of IPersist

C# Definition:

    [ComImport, Guid("0000010b-0000-0000-C000-000000000046"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IPersistFile: IPersist
    {
        new void GetClassID(out Guid pClassID);
        [PreserveSig]
        int IsDirty();

        [PreserveSig]
        void Load([In, MarshalAs(UnmanagedType.LPWStr)]
            string pszFileName, uint dwMode);

        [PreserveSig]
        void Save([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName,
            [In,MarshalAs(UnmanagedType.Bool)] bool fRemember);

        [PreserveSig]
        void SaveCompleted([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName);

        [PreserveSig]
        void GetCurFile([In, MarshalAs(UnmanagedType.LPWStr)] string ppszFileName);        
    }

VB Definition:
Note
.Net2 now includes this definition in System.Runtime.InteropServices.Comtypes namespace, but doesn't include return values for the methods

<ComImport(), Guid("0000010b-0000-0000-C000-000000000046"), _

   InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _

Public Interface IPersistFile

    Inherits IPersist

    <PreserveSig()> Function IsDirty() As Integer
    <PreserveSig()> Function Load(<MarshalAs(UnmanagedType.LPWStr)> ByVal pszFileName As String, _
            ByVal dwMode As STGM) As HRESULT
    <PreserveSig()> Function Save(<MarshalAs(UnmanagedType.LPWStr)> ByVal pszFileName As String, _
            <MarshalAs(UnmanagedType.Bool)> ByVal fRemember As Boolean) As HRESULT
    <PreserveSig()> Function SaveCompleted(<MarshalAs(UnmanagedType.LPWStr)> ByVal pszFileName As String) As HRESULT
    ' CAUTION: This method is untested! It returns a value, so probably should be StringBuilder, but this
    '      disagrees with the C# definition above.
    <PreserveSig()> Function GetCurFile(<MarshalAs(UnmanagedType.LPWStr)> ByVal ppszFileName As Text.StringBuilder) As HRESULT

End Interface

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions