Sign in to follow this  

[.net] Sending a bitmap from one app to another

This topic is 3666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm looking for suggestions on the best way to send a bitmap image from my .NET application to another (managed or unmanaged). The quicker the better. I really don't like the idea of using a File Watcher as it seems very unreliable. What I was thinking is using a dll gateway that allows the two apps to communicate. My app is written in C#, but the app I will be communicating to may be either managed or unmanaged. So I believe my only option is to write the dll in C++. In a C++ dll you can have a shared memory section but it can not be dynamically allocated. So if the bitmap needs to change size, I will need a buffer in shared memory set the largest size it can be. So I was thinking something like this. My .NET App <- C++ dll -> External app (managed or unmanaged) 1. External app sends request to dll for a bitmap sending in the paramters via an exported function in the dll. The request is stored in shared memory in the dll. 2. My .NET App polls the dll for any requests, if it finds on in shared memory it will generate a bitmap, then store that in the dll's shared memory. 3. The External app after sending a request, polls the dll for a bool that indicates the bitmap is ready to receive in the dll's shared memory. 4. When the bool tells the external app the bitmap is ready, it then reads the bitmap form the dll's shared memory and then when finished sets the bool again to indicate the transaction is complete. Any comments on this method? Is there a better way to do this, faster or more reliably?

Share this post


Link to post
Share on other sites
Perhaps this will help? http://www.codeproject.com/cs/threads/dotnetnamedpipespart1.asp
It will be very fast, but might require a bit of work to set up for your own purposes. Of course, Windows Pipelines are created and managed at the WinApi level, so both .NET and C++ have access to them. However, if you're using .NET 3.0/3.5, the framework has built-in functionality for named pipes (see http://www.omegacoder.com/?p=101). The first method should do the job for .NET 2.0, and it's probably easily portable to C++ too.

Share this post


Link to post
Share on other sites

This topic is 3666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this