Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed mspaint just like WordPad using C#

Tags:

c#

.net

api

paint

ipc

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?

like image 302
nikeee Avatar asked May 13 '12 01:05

nikeee


2 Answers

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.

like image 115
Cody Gray Avatar answered Sep 27 '22 23:09

Cody Gray


Visit the following link, don't forget to download the sample project.

http://www.c-sharpcorner.com/UploadFile/mahesh/ActiveDocumentHostControl11102005040550AM/ActiveDocumentHostControl.aspx

like image 31
NET3 Avatar answered Sep 28 '22 00:09

NET3