Home COM GDI+ WebBrowser Data Access

Structured Storage Functions

 

Functions

 

CreateILockBytesOnHGlobal
CreateStreamOnHGlobal
FmtIdToPropStgName
FreePropVariantArray
GetConvertStg
GetHGlobalFromILockBytes
GetHGlobalFromStream
OleConvertIStorageToOLESTREAM
OleConvertIStorageToOLESTREAMEx
OleConvertOLESTREAMToIStorage
OleConvertOLESTREAMToIStorageEx
PropStgNameToFmtId
PropVariantClear
PropVariantCopy
PropVariantInit
ReadClassStg
ReadClassStm
ReadFmtUserTypeStg
SetConvertStg
 

 

StgCreateDocfile

StgCreateDocfileOnILockBytes
StgCreatePropSetStg
StgCreatePropStg
StgCreateStorageEx
StgGetIFillLockBytesOnFile
StgGetIFillLockBytesOnILockBytes
StgIsStorageFile
StgIsStorageILockBytes
StgOpenAsyncDocfileOnIFillLockBytes
StgOpenLayoutDocfile
StgOpenPropStg
StgOpenStorage
StgOpenStorageEx
StgOpenStorageOnILockBytes
StgSetTimes
WriteClassStg
WriteClassStm
WriteFmtUserTypeStg

 

CreateILockBytesOnHGlobal

 

The CreateILockBytesOnHGlobal function creates a byte array object, using global memory as the physical device, which is intended to be the compound file foundation. This object supports a COM implementation of the ILockBytes interface.

 

The supplied ILockBytes pointer can be used by the StgCreateDocfileOnILockBytes function to build a compound file on top of this byte array object. The ILockBytes interface instance calls the GlobalReAlloc function to grow the memory block as required.

 

 

DECLARE FUNCTION CreateILockBytesOnHGlobal _

   LIB "OLE32.DLL" _

   ALIAS "CreateILockBytesOnHGlobal" ( _

   BYVAL hGlobal AS DWORD, _

   BYVAL fDeleteOnRelease AS LONG, _

   BYREF ppLkbyt AS DWORD _

) AS LONG
 

 

CreateStreamOnHGlobal

 

The CreateStreamOnHGlobal function creates a stream object stored in global memory. The memory supports the OLE implementation of the IStream interface.

 

The returned stream object supports both reading and writing, is not transacted, and does not support locking.

 

 

DECLARE FUNCTION CreateStreamOnHGlobal _

   LIB "OLE32.DLL" _

   ALIAS "CreateStreamOnHGlobal" ( _

   BYVAL hGlobal AS DWORD, _

   BYVAL fDeleteOnRelease AS DWORD, _

   BYREF pstm AS DWORD _

) AS LONG
 

 

FmtIdToPropStgName

 

The FmtIdToPropStgName function converts a property set format identifier (FMTID) to its storage or stream name.

 

 

DECLARE FUNCTION FmtIdToPropStgName _

   LIB "OLE32.DLL" _

   ALIAS "FmtIdToPropStgName" ( _

   BYREF pfmtid AS GUID, _

   BYVAL oszName AS DWORD _

) AS LONG
 

 

FreePropVariantArray

 

The FreePropVariantArray function calls PropVariantClear on each of the PROPVARIANT structures in the rgvars array to make the value zero for each of the members of the array.

 

 

DECLARE FUNCTION FreePropVariantArray _

   LIB "OLE32.DLL" _

   ALIAS "FreePropVariantArray" ( _

   BYVAL cVariants AS DWORD, _

   BYVAL rgvars AS DWORD _

) AS LONG
 

 

GetConvertStg

 

The GetConvertStg function returns the current value of the convert bit for the specified storage object.

 

 

DECLARE FUNCTION GetConvertStg _

   LIB "OLE32.DLL" _

   ALIAS "GetConvertStg" ( _

   BYVAL pStg AS DWORD _

) AS LONG
 

 

GetHGlobalFromILockBytes

 

The GetHGlobalFromILockBytes function retrieves a global memory handle to a byte array object created using the CreateILockBytesOnHGlobal function.

 

 

DECLARE FUNCTION GetHGlobalFromILockBytes _

   LIB "OLE32.DLL" _

   ALIAS "GetHGlobalFromILockBytes" ( _

   BYVAL pLkbyt AS DWORD, _

   BYREF phglobal AS DWORD _

) AS LONG
 

 

GetHGlobalFromStream

 

The GetHGlobalFromStream function retrieves the global memory handle to a stream that was created through a call to the CreateStreamOnHGlobal function.

 

 

DECLARE FUNCTION GetHGlobalFromStream _

   LIB "OLE32.DLL" _

   ALIAS "GetHGlobalFromStream" ( _

   BYVAL pstm AS DWORD, _

   BYREF phglobal AS DWORD _

) AS LONG
 

 

OleConvertIStorageToOLESTREAM

 

The OleConvertIStorageToOLESTREAM function converts the specified storage object from OLE 2 structured storage to the OLE 1 storage object model but does not include the presentation data. This is one of several compatibility functions.

 

 

DECLARE FUNCTION OleConvertIStorageToOLESTREAM _

   LIB "OLE32.DLL" _

   ALIAS "OleConvertIStorageToOLESTREAM" ( _

   BYVAL pStg AS DWORD, _

   BYREF lpolestream AS DWORD _

) AS LONG
 

 

OleConvertIStorageToOLESTREAMEx

 

The OleConvertIStorageToOLESTREAMEx function converts the specified storage object from OLE 2 structured storage to the OLE 1 storage object model, including the presentation data. This is one of several functions included in Structured Storage to ensure compatibility between OLE1 and OLE2.

 

 

DECLARE FUNCTION OleConvertIStorageToOLESTREAMEx _

   LIB "OLE32.DLL" _

   ALIAS "OleConvertIStorageToOLESTREAMEx" ( _

   BYVAL pStg AS DWORD, _

   BYVAL cfFormat AS DWORD, _
   BYVAL lWidth AS LONG, _

   BYVAL lHeight AS LONG, _

   BYVAL dwSize AS DWORD, _

   BYREF pmedium AS STGMEDIUM, _

   BYREF lpolestm AS DWORD _

) AS LONG
 

 

OleConvertOLESTREAMToIStorage

 

The OleConvertOLESTREAMToIStorage function converts the specified object from the OLE 1 storage model to an OLE 2 structured storage object without specifying presentation data.

 

 

DECLARE FUNCTION OleConvertOLESTREAMToIStorage _

   LIB "OLE32.DLL" _

   ALIAS "OleConvertOLESTREAMToIStorage" ( _

   BYVAL lpolestream AS DWORD, _

   BYREF pstg AS DWORD, _

   BYREF ptd AS DVTARGETDEVICE _

) AS LONG
 

 

OleConvertOLESTREAMToIStorageEx

 

The OleConvertOLESTREAMToIStorageEx function converts the specified object from the OLE 1 storage model to an OLE 2 structured storage object including presentation data. This is one of several compatibility functions.

 

 

DECLARE FUNCTION OleConvertOLESTREAMToIStorageEx _

   LIB "OLE32.DLL" _

   ALIAS "OleConvertOLESTREAMToIStorageEx" ( _

   BYVAL lpolestm AS DWORD, _

   BYREF pstg AS DWORD, _

   BYREF pcfFormat AS DWORD, _
   BYREF plWidth AS LONG, _

   BYREF plHeight AS LONG, _

   BYREF pdwSize AS DWORD, _

   BYREF pmedium AS STGMEDIUM _

) AS LONG
 

 

PropStgNameToFmtId

 

The PropStgNameToFmtId function converts a property set storage or stream name to its format identifier.

 

 

DECLARE FUNCTION PropStgNameToFmtId _

   LIB "OLE32.DLL" _

   ALIAS "PropStgNameToFmtId" ( _

   BYVAL oszName AS STRING, _  ' Null-terminated unicode string

   BYREF fmtid AS GUID _

) AS LONG
 

 

PropVariantClear

 

The PropVariantClear function frees all elements that can be freed in a given PROPVARIANT structure. For complex elements with known element pointers, the underlying elements are freed prior to freeing the containing element.

 

 

DECLARE FUNCTION PropVariantClear _

   LIB "OLE32.DLL" _

   ALIAS "PropVariantClear" ( _

   BYREF pvar AS ANY _

) AS LONG
 

 

PropVariantCopy

 

The PropVariantCopy function copies the contents of one PROPVARIANT structure to another.

 

 

DECLARE FUNCTION PropVariantCopy _

   LIB "OLE32.DLL" _

   ALIAS "PropVariantCopy" ( _

   BYREF pvarDest AS ANY, _

   BYREF pvarSrc AS ANY _

) AS LONG
 

 

PropVariantInit

 

The PropVariantInit function initializes a PROPVARIANT structure.

 

Note  This function is implemented as a macro, available by including the provided ole2.h header file. This function is not exported from any system-provided DLL.

 

 

#define PropVariantInit(p) memset((p), 0, sizeof(PROPVARIANT))")
 

It is not needed with PowerBASIC, that already initializes the variable, but you can use:

 

ZeroMemory(BYVAL VARPTR(p), SIZEOF(PROPVARIANT))
 

 

ReadClassStg

 

The ReadClassStg function reads the CLSID previously written to a storage object with the WriteClassStg function.

 

 

DECLARE FUNCTION ReadClassStg _

   LIB "OLE32.DLL" _

   ALIAS "ReadClassStg" ( _

   BYVAL pStg AS DWORD, _

   BYREF pclsid AS GUID _

) AS LONG
 

 

ReadClassStm

 

The ReadClassStm function reads the CLSID previously written to a stream object with the WriteClassStm function.

 

 

DECLARE FUNCTION ReadClassStm _

   LIB "OLE32.DLL" _

   ALIAS "ReadClassStm" ( _

   BYVAL pStm AS DWORD, _

   BYREF pclsid AS GUID _

) AS LONG
 

 

ReadFmtUserTypeStg

 

The ReadFmtUserTypeStg function returns the clipboard format and user type previously saved with the WriteFmtUserTypeStg function.

 

 

DECLARE FUNCTION ReadFmtUserTypeStg _

   LIB "OLE32.DLL" _

   ALIAS "ReadFmtUserTypeStg" ( _

   BYVAL pStg AS DWORD, _

   BYREF pcf AS DWORD, _

   BYREF lplpszUserType AS DWORD _

) AS LONG
 

 

SetConvertStg

 

The SetConvertStg function sets the convert bit in a storage object to indicate that the object is to be converted to a new class when it is opened. The setting can be retrieved with a call to the GetConvertStg function.

 

 

DECLARE FUNCTION SetConvertStg _

   LIB "OLE32.DLL" _

   ALIAS "SetConvertStg" ( _

   BYVAL pStg AS DWORD, _

   BYVAL fConvert AS LONG _

) AS LONG
 

 

StgCreateDocFile

 

The StgCreateDocfile function creates a new compound file storage object using the COM-provided compound file implementation for the IStorage interface.

 

Note  All Microsoft Windows 2000 and Windows XP applications should use the new function, StgCreateStorageEx, instead of StgCreateDocfile, to take advantage of enhanced Structured Storage features. This function, StgCreateDocfile, still exists for compatibility with Windows 2000 and earlier applications.

 

 

DECLARE FUNCTION StgCreateDocFile _

   LIB "OLE32.DLL" _

   ALIAS "StgCreateDocfile" ( _

   BYVAL pwcsName AS DWORD, _  ' Null-terminated unicode string

   BYVAL grfMode AS DWORD, _

   BYVAL reserved AS DWORD, _

   BYREF ppstgOpen AS DWORD _

) AS LONG
 

Note: pwcsName has been declared as DWORD, instead of as STRING, because it can be NULL.

 

 

StgCreateDocFileOnILockBytes

 

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.

 

 

DECLARE FUNCTION StgCreateDocfileOnILockBytes _

   LIB "OLE32.DLL" _

   ALIAS "StgCreateDocfileOnILockBytes" ( _

   BYVAL plkbyt AS DWORD, _

   BYVAL grfMode AS DWORD, _

   BYVAL reserved AS DWORD, _

   BYREF ppstgOpen AS DWORD _

) AS LONG
 

 

StgCreatePropSetStg

 

The StgCreatePropSetStg function creates a property set storage object from a specified storage object. The property set storage object supplies the system-provided, stand-alone implementation of the IPropertySetStorage interface.

 

 

DECLARE FUNCTION StgCreatePropSetStg _

   LIB "OLE32.DLL" _

   ALIAS "StgCreatePropSetStg" ( _

   BYVAL pStorage AS DWORD, _

   BYVAL dwReserved AS DWORD, _

   BYREF ppPropSetStg AS DWORD _

) AS LONG
 

 

StgCreatePropStg

 

The StgCreatePropStg function creates and opens a property set in a specified storage or stream object. The property set supplies the system-provided, stand-alone implementation of the IPropertyStorage interface.

 

 

DECLARE FUNCTION StgCreatePropStg _

   LIB "OLE32.DLL" _

   ALIAS "StgCreatePropStg" ( _

   BYVAL pUnk AS DWORD, _

   BYREF fmtid AS GUID, _

   BYREF pclsid AS GUID, _

   BYVAL grfFlags AS DWORD, _

   BYVAL dwReserved AS DWORD, _

   BYREF ppPropStg AS DWORD _

) AS LONG
 

 

StgCreateStorageEx

 

The StgCreateStorageEx function creates a new storage object using a provided implementation for the IStorage or IPropertySetStorage interfaces. To open an existing file, use the StgOpenStorageEx function instead.

 

Applications written for Windows 2000, Windows Server 2003 and Windows XP must use StgCreateStorageEx rather than StgCreateDocfile to take advantage of the enhanced Windows 2000 and Windows XP Structured Storage features.

 

 

DECLARE FUNCTION StgCreateStorageEx _

   LIB "OLE32.DLL" _

   ALIAS "StgCreateStorageEx" ( _

   BYVAL pwcsName AS DWORD, _  ' Null-terminated unicode string

   BYVAL grfMode AS DWORD, _

   BYVAL stgfmt AS DWORD, _

   BYVAL grfAttrs AS DWORD, _

   BYVAL pStgOptions AS DWORD, _
   BYVAL reserved2 AS DWORD, _

   BYREF riid AS GUID, _

   BYREF ppObjectOpen AS DWORD _

) AS LONG
 

Note: pwcsName has been declared as DWORD, instead of as STRING, because it can be NULL.

 

 

StgGetIFillLockBytesOnFile

 

Note  The StgGetIFillLockBytesOnFile function is obsolete. The following information is provided to support Windows NT 4.0 and earlier operating systems.

 

The StgGetIFillLockBytesOnFile function opens a wrapper object on a temporary file.

 

 

DECLARE FUNCTION StgGetIFillLockBytesOnFile _

   LIB "OLE32.DLL" _

   ALIAS "StgGetIFillLockBytesOnFile" ( _

   BYVAL pwcsName AS STRING, _  ' Null-terminated unicode string

   BYREF ppflb AS DWORD _

) AS LONG
 

 

StgGetIFillLockBytesOnILockBytes

 

Note  The StgGetIFillLockBytesOnILockBytes function is obsolete and the following information is provided for pre-Windows 2000/XP purposes only.

 

Creates a new wrapper object on a byte array object provided by the caller.

 

 

DECLARE FUNCTION StgGetIFillLockBytesOnILockBytes _

   LIB "OLE32.DLL" _

   ALIAS "StgGetIFillLockBytesOnILockBytes" ( _

   BYVAL pilb AS DWORD, _

   BYREF ppflb AS DWORD _

) AS LONG
 

 

StgIsStorageFile

 

The StgIsStorageFile function indicates whether a particular disk file contains a storage object.

 

 

DECLARE FUNCTION StgIsStorageFile _

   LIB "OLE32.DLL" _

   ALIAS "StgIsStorageFile" ( _

   BYVAL pwcsName AS STRING' Null-terminated unicode string

) AS LONG
 

 

StgIsStorageIlockBytes

 

The StgIsStorageILockBytes function indicates whether the specified byte array contains a storage object.

 

 

DECLARE FUNCTION StgIsStorageILockBytes _

   LIB "OLE32.DLL" _

   ALIAS "StgIsStorageILockBytes" ( _

   BYVAL plkbyt AS DWORD _

) AS LONG
 

 

StgOpenAsyncDocFileOnIFillLockBytes

 

Note  The StgOpenAsyncDocfileOnIFillLockBytes function is obsolete. The following information is provided to support Windows XP and earlier operating systems.

 

The StgOpenAsyncDocfileOnIFillLockBytesopens an existing root asynchronous storage object on a byte-array wrapper object provided by the caller.

 

 

DECLARE FUNCTION StgOpenAsyncDocfileOnIFillLockBytes _

   LIB "OLE32.DLL" _

   ALIAS "StgOpenAsyncDocfileOnIFillLockBytes" ( _

   BYVAL ppflb AS DWORD, _

   BYVAL grfmode AS DWORD, _

   BYVAL asyncFlags AS DWORD, _

   BYREF ppstgOpen AS DWORD _

) AS LONG
 

 

StgOpenLayoutDocFile

 

The StgOpenLayoutDocfile function opens a compound file on an ILockBytes implementation that is capable of monitoring sector data. To call StgOpenLayoutDocfile, both DfLayout.dll and DfLayout.lib are required. These files are only available in the Windows 98 Resource Kit.

 

Note  Do not use this function. Use the IStorage::CopyTo method instead. CopyTo can be used to layout a docfile, thus improving performance in most scenarios.

 

 

StgOpenPropStg

 

The StgOpenPropStg function opens a specified property set in a specified storage or stream object. The property set supplies the system-provided, stand-alone implementation of the IPropertyStorage interface.

 

 

DECLARE FUNCTION StgOpenPropStg _

   LIB "OLE32.DLL" _

   ALIAS "StgOpenPropStg" ( _

   BYVAL pUnk AS DWORD, _

   BYREF fmtid AS GUID, _

   BYVAL grfFlags AS DWORD, _

   BYVAL dwReserved AS DWORD, _

   BYREF ppPropStg AS DWORD _

) AS LONG
 

 

StgOpenStorage

 

The StgOpenStorage function opens an existing root storage object in the file system. Use this function to open compound files. Do not use it to open directories, files, or summary catalogs. Nested storage objects can only be opened using their parent IStorage::OpenStorage method.

 

Note  All Windows 2000 and Windows XP applications should use the new function, StgOpenStorageEx, instead of StgOpenStorage, to take advantage of the enhanced and Windows Structured Storage features. This function, StgOpenStorage, still exists for compatibility with applications running on Windows 2000 and earlier.

 

 

 

DECLARE FUNCTION StgOpenStorage _

   LIB "OLE32.DLL" _

   ALIAS "StgOpenStorage" ( _

   BYVAL pwcsName AS DWORD, _  ' Null-terminated unicode string

   BYVAL pstgPriority AS DWORD, _

   BYVAL grfMode AS DWORD, _

   BYVAL snbExclude AS DWORD, _

   BYVAL reserved AS DWORD, _

   BYREF ppstgOpen AS DWORD _

) AS DWORD
 

Note: pwcsName has been declared as DWORD, instead of as STRING, because it can be NULL.

 

 

StgOpenStorageEx

 

The StgOpenStorageEx function opens an existing root storage object in the file system. Use this function to open Compound Files and regular files. To create a new file, use the StgCreateStorageEx function.

 

Note  To use enhancements, all Windows 2000, Windows XP, and Windows Server 2003 applications should call StgOpenStorageEx, instead of StgOpenStorage. The StgOpenStorage function is used for compatibility with Windows 2000 and earlier applications.

 

 

DECLARE FUNCTION StgOpenStorageEx _

   LIB "OLE32.DLL" _

   ALIAS "StgOpenStorageEx" ( _

   BYVAL pwcsName AS DWORD, _  ' Null-terminated unicode string

   BYVAL grfMode AS DWORD, _

   BYVAL stgfmt AS DWORD, _

   BYVAL grfAttrs AS DWORD, _
   BYVAL pStgOptions AS DWORD, _

   BYVAL reserved2 AS DWORD, _

   BYREF riid AS GUID, _

   BYREF ppObjectOpen AS DWORD _

) AS DWORD
 

Note: pwcsName has been declared as DWORD, instead of as STRING, because it can be NULL.

 

 

StgOpenStorageOnILockBytes

 

The StgOpenStorageOnILockBytes function opens an existing storage object that does not reside in a disk file, but instead has an underlying byte array provided by the caller.

 

 

DECLARE FUNCTION StgOpenStorageOnILockBytes _

   LIB "OLE32.DLL" _

   ALIAS "StgOpenStorageOnILockBytes" ( _

   BYVAL plkbyt AS DWORD, _

   BYVAL pStgPriority AS DWORD, _

   BYVAL grfMode AS DWORD, _
   BYVAL snbExclude AS DWORD, _

   BYVAL reserved AS DWORD, _

   BYREF ppstgOpen AS DWORD _

) AS LONG
 

 

StgSetTimes

 

The StgSetTimes function sets the creation, access, and modification times of the indicated file, if supported by the underlying file system.

 

 

DECLARE FUNCTION StgSetTimes _

   LIB "OLE32.DLL" _

   ALIAS "StgSetTimes" ( _

   BYVAL lpszName AS STRING, _  ' Null-terminated unicode string

   BYREF pctime AS FILETIME, _

   BYREF patime AS FILETIME, _

   BYREF pmtime AS FILETIME _

) AS LONG
 

 

WriteClassStg

 

The WriteClassStg function stores the specified class identifier (CLSID) in a storage object.

 

 

DECLARE FUNCTION WriteClassStg _

   LIB "OLE32.DLL" _

   ALIAS "WriteClassStg" ( _

   BYVAL pStg AS DWORD, _

   BYREF rclsid AS GUID _

) AS LONG
 

 

WriteClassStm

 

The WriteClassStm function stores the specified CLSID in the stream.

 

 

DECLARE FUNCTION WriteClassStm _

   LIB "OLE32.DLL" _

   ALIAS "WriteClassStm" ( _

   BYVAL pStm AS DWORD, _

   BYREF rclsid AS GUID _

) AS LONG
 

 

WriteFmtUserTypeStg

 

The WriteFmtUserTypeStg function writes a clipboard format and user type to the storage object.

 

 

DECLARE FUNCTION WriteFmtUserTypeStg _

   LIB "OLE32.DLL" _

   ALIAS "WriteFmtUserTypeStg" ( _

   BYVAL pStg AS DWORD, _

   BYVAL cf AS DWORD, _

   BYVAL lpszUserType AS STRING' Null-terminated unicode string

) AS LONG
 

 

Page last updated on Thursday, 13 July 2006 00:34:17 +0200