IOpcFactory::CreateStreamOnFile method
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
- filename [in]
-
The name of the file over which the stream is created.
- ioMode [in]
-
The value that describes the read/write status of the stream to be created.
- securityAttributes [in]
-
For information about the SECURITY_ATTRIBUTES structure in this parameter, see the CreateFile function.
- dwFlagsAndAttributes [in]
-
The settings and attributes of the file. For most files, FILE_ATTRIBUTE_NORMAL can be used.
For more information about this parameter, see CreateFile.
- stream [out, retval]
-
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
|
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] |
|
Header |
|
|
IDL |
|
See also
- IOpcFactory
- Overviews
- Loading a Package
- Getting Started with the Packaging API
- Packaging API Programming Guide
- Parts Overview
- Platform Update for Windows Vista
- Saving a Package
- Reference
- CreateFile
- OPC_STREAM_IO_MODE
- Packaging Errors
- Packaging API Reference
- Packaging API Samples
- External Resources
- ECMA-376 OpenXML
- RFC 3986: URI Generic Syntax