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

StgCreateDocfile (ole32)
 
.
Summary
Summary

C# Signature:

    /// <summary>
    /// The StgCreateDocfileOnILockBytes function creates and opens a new compound file
    /// storage object on top of a byte-array object provided by the caller. The storage
    /// object supports the COM-provided, compound-file implementation for the IStorage interface.
    /// </summary>
    /// <param name="plkbyt">A pointer to the ILockBytes interface on the underlying byte-array object on which to create a compound file.</param>
    /// <param name="grfMode">Specifies the access mode to use when opening the new compound file. For more information, see STGM Constants.</param>
    /// <param name="reserved">Reserved for future use; must be zero.</param>
    /// <param name="ppstgOpen">A pointer to the location of the IStorage pointer on the new storage object.</param>
    /// <returns>
    /// S_OK
    ///    Indicates that the compound file was successfully created.
    ///STG_E_ACCESSDENIED
    ///    Access denied because the caller does not have enough permissions, or another caller has the file open and locked.
    ///STG_E_FILEALREADYEXISTS
    ///    Indicates that the compound file already exists and the grfMode parameter is set to STGM_FAILIFTHERE.
    ///STG_E_INSUFFICIENTMEMORY
    ///    Indicates that the storage object was not created due to inadequate memory.
    ///STG_E_INVALIDPOINTER
    ///    Indicates that a non-valid pointer was in the pLkbyt parameter or the ppStgOpen parameter.
    ///STG_E_INVALIDFLAG
    ///    Indicates that a non-valid flag combination was in the grfMode parameter.
    ///STG_E_TOOMANYOPENFILES
    ///    Indicates that the storage object was not created due to a lack of file handles.
    ///STG_E_LOCKVIOLATION
    ///    Access denied because another caller has the file open and locked.
    ///STG_E_SHAREVIOLATION
    ///    Access denied because another caller has the file open and locked.
    ///STG_S_CONVERTED
    ///    Indicates that the compound file was successfully converted. The original byte-array object was successfully converted to IStorage format.
    /// </returns>
    [DllImport ("ole32.dll")]
    public extern static int StgCreateDocfileOnILockBytes(ILockBytes plkbyt, StgmConstants grfMode, int reserved, out IStorage ppstgOpen);

[DllImport("ole32.dll")]
static extern int StgCreateDocfile([MarshalAs(UnmanagedType.LPWStr)]
   string pwcsName, STGM grfMode, uint reserved, out IStorage ppstgOpen);

User-Defined Types:

None.

Notes:

See StgmConstants for the flags corresponding to the grfMode parameter.

None.

Tips & Tricks:

Please add some!

User-Defined Types:

STGM

Sample Code:

Please add some!

Tips & Tricks:

On Windows 2000 and up you should use StgCreateStorageEx instead.

Alternative Managed API:

Do you know one? Please contribute it!

Sample Code:

Please add some!

Documentation

Alternative Managed API:

See StgOpenStorageEx for an example of using the System.IO.Packaging classes to access OLE structured storage.

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

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