A set of .NET Framework managed libraries for developing graphical user interfaces.
I need my Memory Mapped File to exist so long as ANY instances of my app are running at a given time, with the MMF disappeared only when no application instances are running. And it can't matter what the order of the instances closing is compared to the order of them opening. I imagine an MMF effectively with array of InstanceInfo, with InstanceInfo so defined:
<StructLayout(LayoutKind.Sequential, CharSet:= CharSet.Unicode> _
Public Class InstanceInfo
InstanceId As Integer 'process Id of an instance
<MarshalAs(UnmangedType.ByValTStr, SizeConst:= 260> _
InstanceFile As String 'file being used by instance
End With
The MMF array gets searched to see if any items contain an InstanceFile value identical to a file about to be opened. When a file is actually opened in the current instance, a new InstanceInfo item is added to the MMF array (with .InstanceId = Process.GetCurrentProcess.Id and .InstanceFile = FileName); when the file is closed, the item is removed from the MMF. Only when all application instances are closed should the MMF be deleted.