Shared Memory

G

Guest

I have several apps (some written in VB6, others in VB.NET) that need to be
able to see the same area of memory (shared memory), in particular an array.
I know that I can use win api calls (CreateFileMapping, MapViewOfFile etc.)
from multiple VB6 apps to look at this shared memory. The shared memory
represents an array of some vb types (class's and structures in vb.net). I
don't seem to find any documentation and examples of how to use these API's
via vb.net. I have read on remoting in .NET but that requires a TCP
connection in which case I have a TCP server listening for requests. I don't
want to use sockets, but stick to the API. How do I do this in VB.NET? I
have also found some references to Interop but again have no solid examples.
 
J

Jeffrey Tan[MSFT]

Hi jaklithn,

Thanks for your post.

Using memory mapping file in .Net is almost the same way as using it in
Win32, what we must care is the p/invoke issue. The below 2 articles shows
samples regarding how to use memory mapping file to do inter-process
communication in .Net:
"DevGlobalCache - A way to Cache and Share data between processes"
http://www.codeproject.com/dotnet/globalcache.asp
"A C# Framework for Interprocess Synchronization and Communication"
http://www.codeproject.com/csharp/csthreadmsg.asp

Hope this helps

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top