Search code examples
c#.netipcpaint

Embed mspaint just like WordPad using C#


I just took a look at Wordpad. There is a ribbon button called Insert Paint Drawing. When I click that button, mspaint opens up and prompts me to draw something. After drawing something, I can click the Update document button. There is no save option (only Save copy as).

no exit button

Also, there is no exit button. Instead it show an Exit and return to document button.

Now my questions are:
If and how can I benefit from this functionality in my C# desktop application? I thought about some IPC, but I couldn't figure out how it could work. Anyone got an idea?


Solution

  • This is called OLE (object linking and embedding). You're embedding a Microsoft Paint document into a Wordpad document. This technology has been around since Windows 95.

    The .NET Framework has no support for OLE whatsoever. If you really wanted to do this, you would be better off writing a C++ app and taking advantage of either the MFC or ATL libraries, which have explicit support for this. More information about targeting .NET is available in the answers to this question.