I have been Googling on and off for a few weeks...searching for answer and not finding anything that fits my needs precisely. So, I'll ask the experts here.
I currently have a managed (C#) Windows application that contains an image viewer in the main form. At present, the application uses PInvoke to pass a handle to its viewer down to an unmanaged (C++) dll. The jpeg image that the user sees in the main (managed) form is the result of data being fed into its HANDLE on the unmanaged side - using the old school "InvalidateRect()" calls and such.
What I want to do is decouple the managed code from the unmanaged and create two separate executables - essentially getting rid of the need for PInvoke.
However, I would still like to be able to have the unmanaged code (which would now exist in its own separate process) manipulate the image viewer in the main (managed) program.
But before spending untold hours beating my head against the wall (in trying to get something to work that may be impossible), I was wondering if anyone knows if this can even be done.
I know that native HANDLEs can be passed from an unmanaged process to another unmanaged process with pipes and DuplicateHandle(). I also (obviously) know that a handle can be passed from managed code to unmanaged code within the same process as that is the situation I have now.
But, is it possible to combine the two: to have a managed process get a handle to its window and send it to an unmanaged process (through a named pipe) where DuplicateHandle can be used to refresh and then manipulate the viewer in the managed process through the duped handle?
.NET now supports named pipes - so I'm hopeful.
Any advice/insight would be much appreciated.