Richedit supports an ImportDataObject method through the IricHEDITOLE interface, which can replace the current selection area with the specified iDataObject, just create an iDataObject that contains images. After reading MSDN, I can make it, IdataObject is such a common interface that does not have a default implementation throughout Win32API? To know that 9 members of iDataObject plus the associated IdataAdviseHolder flow of additional garbage do not come to the 200-line code, but don't come. Although the specific implementation of this non-cross-process only supports images can be small, but I really can't afford to make big surgery for this code. Turning out the document of the COLEDATAOBJECT, carefully, calling such a name, can not be the implementation of IdataObject ?! Is the engineer of MS is a brain into water? After half an hour, I found that IdataObject is included in Coledatasource. I really don't know how to describe the feelings of the time ............ Harvest still, this is surprisingly complete, including some problems I didn't expect Inside, since there is no difficulty in this remaining problem, the code is as follows: COLEDATASOURCE SRC; STGMEDIUM SM; Sm.TyMed = TYMED_GDI; sm.hbitmap = hbmp; sm.punkforrelease = null; src.cachedata (cf_bitmap, & sm ); LpdataObject lpdataObject = (lpdataobject) src.getInterface (& IID_IDataObject); PricheDitole-> ImportDataObject (LPDataObject, 0, null); lpdataObject-> release ();
Author Blog:
http://blog.9cbs.net/windoze/