MemoryMappedFileStatic: CreateOrOpen

CreateOrOpen

Creates or opens a memory-mapped file that has the specified capacity and access type in system memory.



 Public Function CreateOrOpen(
	  ByRef MapName As String,
	  ByVal Capacity As Currency,
	  Optional ByVal Access As MemoryMappedFileAccess = MemoryMappedFileAccess. ReadWrite ) As MemoryMappedFile

Parameters

MapName
[ByRef] String. A name to assign to the memory-mapped file.
Capacity
[ByVal] Currency. The maximum size, in bytes, to allocate to the memory-mapped file.
Access
[ByVal] Optional. MemoryMappedFileAccess. One of the enumeration values that specifies the type of access allowed to the memory-mapped file. The default is ReadWrite.  

Default: MemoryMappedFileAccess . ReadWrite

Return Values

MemoryMappedFile -  A memory-mapped file that has the specified characteristics.

Remarks

Use this method to create or open a memory-mapped file that is not persisted (that is, not associated with a file on disk), which you can use to share data between processes.

Exceptions

ExceptionCondition
ArgumentExceptionMapName is an empty string.
ArgumentNullExceptionMapName is vbNullString.
ArgumentOutOfRangeException Capacity is greater than the size of the logical address space.
-or-
Capacity is less than or equal to zero.
-or-
Access is not a valid MemoryMappedFileAccess enumeration value.

See Also

Project CorLib Overview

Class MemoryMappedFileStatic Overview