HOWTO Make a C# UserContol Memory Map to a C++/MFC/EXE
Please help,
I have a UserControl that I want to have "talk" to a C++/MFC/EXE program
that is already running via a memory map.
The C++/MFC/EXE app is using the traditional WIN32 commands like
OpenFileMapping
MapViewOfFile
UnmapViewOfFile
And others.
Put another way, the C++/MFC/EXE is using plain/jain Memory Map Techniques,
where the memory map has a "known" name, and any application can access the
memory map in the same "Desktop".
I am not sure which C#/.NET functionality I should use. I see the
MemoryStream class, but I see no reference to it being "compatible" to Memory
Maps.
Please advise. 7 5826
ATS,
The MemoryStream class is just a class that will allow you to get
stream-semantics while using a byte array as the back-end store. It has
nothing to do with memory maps.
If you want to use memory maps, you will have to make a call to the same
API calls through the P/Invoke layer.
You could wrap it up in a Stream-based class if you want, and then
read/write back and forth.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"ATS" <AT*@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com... HOWTO Make a C# UserContol Memory Map to a C++/MFC/EXE
Please help,
I have a UserControl that I want to have "talk" to a C++/MFC/EXE program that is already running via a memory map.
The C++/MFC/EXE app is using the traditional WIN32 commands like
OpenFileMapping MapViewOfFile UnmapViewOfFile
And others.
Put another way, the C++/MFC/EXE is using plain/jain Memory Map Techniques, where the memory map has a "known" name, and any application can access the memory map in the same "Desktop".
I am not sure which C#/.NET functionality I should use. I see the MemoryStream class, but I see no reference to it being "compatible" to Memory Maps.
Please advise.
Thanks Nicholas for the reply,
So, there is no .NET/C# equivalent for Memory Maps at all?
ATS,
No, there is not.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"ATS" <AT*@discussions.microsoft.com> wrote in message
news:B3**********************************@microsof t.com... Thanks Nicholas for the reply,
So, there is no .NET/C# equivalent for Memory Maps at all?
I put together a caching mechanism using memory-mapped files and had the
opportunity to try out three or four different implementations in .NET. The
best and most reliable one I found was a freeware offering called
"MetalWrench ToolBox", which is unfortunately no longer "findable" on the
net. However, there is a copy of it in the download that accompanies this
article that I wrote about it: http://www.eggheadcafe.com/articles/20050116.asp
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"ATS" wrote: HOWTO Make a C# UserContol Memory Map to a C++/MFC/EXE
Please help,
I have a UserControl that I want to have "talk" to a C++/MFC/EXE program that is already running via a memory map.
The C++/MFC/EXE app is using the traditional WIN32 commands like
OpenFileMapping MapViewOfFile UnmapViewOfFile
And others.
Put another way, the C++/MFC/EXE is using plain/jain Memory Map Techniques, where the memory map has a "known" name, and any application can access the memory map in the same "Desktop".
I am not sure which C#/.NET functionality I should use. I see the MemoryStream class, but I see no reference to it being "compatible" to Memory Maps.
Please advise.
Thanks for the reply,
That is a big dissapointment that .NET does not support Memory Mapped Files.
The excuse of scrapping all code features for the cause of "managed code" is
obviously the reasoning behind not supporting Memory Mapped Files, and it is
a poor excuse. Interprocess communnication with Memory Map Files is a valid
and highly needed software development technique.
There are lots of Windows API's that aren't built in to the .NET platform.
That's what the P/Invoke layer is for.
Cheers,
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"ATS" wrote: HOWTO Make a C# UserContol Memory Map to a C++/MFC/EXE
Please help,
I have a UserControl that I want to have "talk" to a C++/MFC/EXE program that is already running via a memory map.
The C++/MFC/EXE app is using the traditional WIN32 commands like
OpenFileMapping MapViewOfFile UnmapViewOfFile
And others.
Put another way, the C++/MFC/EXE is using plain/jain Memory Map Techniques, where the memory map has a "known" name, and any application can access the memory map in the same "Desktop".
I am not sure which C#/.NET functionality I should use. I see the MemoryStream class, but I see no reference to it being "compatible" to Memory Maps.
Please advise.
ATS,
Actually, I wouldn't think that is the case. I think security is a
bigger reason why there are no memory mapped file implementations.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"ATS" <AT*@discussions.microsoft.com> wrote in message
news:6D**********************************@microsof t.com... Thanks for the reply,
That is a big dissapointment that .NET does not support Memory Mapped Files. The excuse of scrapping all code features for the cause of "managed code" is obviously the reasoning behind not supporting Memory Mapped Files, and it is a poor excuse. Interprocess communnication with Memory Map Files is a valid and highly needed software development technique.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Josef Sachs |
last post by:
Is Andrew Kuchling's regex-to-re HOWTO available anywhere?
I've found the following (dead) links on various Web pages:
http://py-howto.sourceforge.net/regex-to-re/regex-to-re.html...
|
by: Guy Robinson |
last post by:
Hello,
I have a directory of python scripts that all (should) contain a number of
attributes and methods of the same name.
I need to import each module, test for these items and unload the...
|
by: CSN |
last post by:
Is it possible to iterate over an array in plpgsql?
Something like:
function insert_stuff (rel_ids int)
....
foreach rel_ids as id
insert into table (rel_id, val)
values (id, 5);
|
by: Brian Reed |
last post by:
I have a class that I want to serialize to an XML string. I want the XML to serialize to utf-8 encoding. When I serialize to an XML file, the data looks great. When I try to serialize to a String...
|
by: Allan Ebdrup |
last post by:
Hi
I have two strings in memory, a XML document and a Schema, I would like a
function that takes these two as parameters and returns an errordescription
if the XML does not validate and an empty...
|
by: Mark Harrison |
last post by:
HOWTO: Integrating Posgresql queries into an event loop.
Mark Harrison
mh@pixar.com
May 27, 2004
Problem
-------
The commonly used postgresql APIs will block until completed.
|
by: BStrick |
last post by:
I would like to know what may be the "Best" way to approach with
problem.
I have an application that I created to transfers data dynamically from
an unknown source (ie maybe Excel, Access, XML,...
|
by: Bernd Muent |
last post by:
Hi together,
I made a DLL in the following way (simplified example just to explain
what is the problem) using devcpp and gcc compiler on Windows XP:
dll.h:
#ifndef _DLL_H_
#define _DLL_H_
#if...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |