IOpcFactory::CreateStreamOnFile method (msopc.h)
Creates a stream over a file. This method is a simplified wrapper for a call to the CreateFile function. CreateFile parameters that are not exposed through this method use their default values. For more information, see CreateFile.
Syntax
HRESULT CreateStreamOnFile(
[in] LPCWSTR filename,
[in] OPC_STREAM_IO_MODE ioMode,
[in] LPSECURITY_ATTRIBUTES securityAttributes,
[in] DWORD dwFlagsAndAttributes,
[out, retval] IStream **stream
);
Parameters
[in] filename
The name of the file over which the stream is created.
[in] ioMode
The value that describes the read/write status of the stream to be created.
[in] securityAttributes
For information about the SECURITY_ATTRIBUTES structure in this parameter, see the CreateFile function.
[in] dwFlagsAndAttributes
The settings and attributes of the file. For most files, FILE_ATTRIBUTE_NORMAL can be used.
For more information about this parameter, see CreateFile.
[out, retval] stream
A pointer to the IStream interface of the stream.
Return value
The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
Return code | Description |
---|---|
|
The method succeeded. |
|
The value passed in the ioMode parameter is not a valid OPC_STREAM_IO_MODE enumeration value. |
|
At least one of the filename and stream parameters is NULL. |
|
An HRESULT error code from the CreateFile function. |
Remarks
Do not use a stream to serialize package data when the same stream is being used to deserialize a package, because the attempt may result in undefined behavior.
For information about using this method when loading or saving a package, see the Loading a Package or Saving a Package programming task.
Support on Previous Windows Versions
The behavior and performance of this method is the same on all supported Windows versions. For more information, see Getting Started with the Packaging API, and Platform Update for Windows Vista.Thread Safety
Packaging objects are not thread-safe.
For more information, see the Getting Started with the Packaging API.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | msopc.h |
See also
External Resources
Getting Started with the Packaging API
Overviews
Packaging API Programming Guide
Platform Update for Windows Vista
Reference