Reputation: 15566
I have a huge MFC MDI application that draws on its scrollable view area using device context. This application uses a 3rd party library to do some additional drawing in the same view area. It works by passing the DC (Device Context) of the view area to this 3rd party library (dll) and then the DLL does the additional drawing which is pretty complex.
However, we are converting our whole application to 64 bit and the problem is that we do not have 64 bit version of this 3rd party library. Which leaves us with one option only and that is to move this 3rd party library to a separate process and then make out-of-process calls between our main Application and this new Process hosting this 3rd party library.
But now, how do we do cross-process drawing? Is there any way to do this stuff using plain GDI or MFC?
Upvotes: 3
Views: 604
Reputation: 91845
This answer says that you can't just pass the HDC
from one process to another.
What you might be able to do instead is to:
GetDIBits
on your DC to get the raw bitmap bits.SetDIBits
to put them in a memory DC in the other process.For IPC, I'd suggest simply mapping a chunk of shared memory into both processes. The performance will probably be pretty poor, but you should be able to get away with it.
I believe that Google Chrome does something similar to isolate the rendering engine from the individual tabs.
Upvotes: 1