Start of richedit study 01

Source: Internet
Author: User
Tags ole

Study background

I have participated in three im products since my career, and I am mainly responsible for interface library development. As we all know, the im software has a very important control for message display. The implementation method is almost Based on richedit (currently this is the main method, represented by QQ), based on webbrowser (represented: GTalk), there may be WebKit-based, I did not deliberately collect. In many cases, you can easily draw your own images in games.

 

I used to imitate the implementation of GTalk. Due to my lack of experience at the time and problems in communicating with people who write pages at the company, the effect was not so satisfactory and it was enough, later, I left and did not continue to do this research. This method is feasible in terms of mechanisms, and there are not many native tasks.

 

Later, I was working on richedit, where I arranged for others to be responsible. In the development process, I encountered various problems and used various "tricks" that were not elegant. Due to the lack of OLE knowledge, the people who made it were very painful and could not find fun. There is an official Microsoft example, but only the tip of the use; codeproject also has a few poor examples that cannot be used in commercial applications; most of the Articles on internet search are simple insertion of images.

 

Many articles in the Chrome open-source extraction-based interface development framework have been supported, and I have grown a lot in the extraction process. To use the extracted engine for commercial development, I personally think it is mainly about rich text rendering, which enables me to start researching richedit. Intermittent, during which various things will be abandoned. Later, a netizen found me again on this issue. After temporarily helping him solve the problem, he lamented why he could not find an elegant solution on the Internet or even gave an in-depth introduction?

 

Author of megax. I have been familiar with the vast majority of conceptual knowledge in the series of articles. However, many of them have not gone into depth, and their experience is far inferior to that of the article owner.

 

Most of Richedit's research involves OLE. Nowadays, with the development of computer technology, Windows platforms are no longer so popular, Windows technology is no longer so powerful, and Mfc is becoming more and more abandoned. Windows programmers are sincere and fearful, the new generation has positioned itself on a cool, cool, and passionate Technology Platform early on. Before Windows Native development fails, I plan to give full play to the "Waste Heat" of the OLE knowledge I have learned, and solve the problem of applying richedit to the im field, I hope to help others, and I do not want to duplicate the wheel.

Study objectives

Richedit is the underlying component of Windows, not even the Win2K code leaked in 2004. It is independent of the edit component, and edit is located in ntuser, which is also quite the underlying component, although it appears in the leaked code, it is unlikely to be extracted. From a certain point of view, Reactos is the copy of the Code, which can be seen from the update list. It is strange that there is richedit in the Reactos code, and I also transplanted it, but later I found that the function was too weak and there was no availability, so I gave up. As for whether Wine copied the code, I don't know, and I don't have the energy to follow up.

 

Richedit's interface is quite stable. I have tested it completely in Win8 and it should last for a long time, so it is worth studying.

 

View framework of Chrome open-source extraction-based interface development framework. If there is a rich-text rendering tool, it should be presented with ole, I want to become a UI solution for commercial Internet development.

 

Richedit is the same as WebKit in terms of mechanism, or it should be said in reverse. The Richedit window is an encapsulation of ITextServices and provides platform support for ITextHost interface interaction with ITextServices. ITextServices supports two categories: text-based ITextDocument and ole-based IRichEditOle. As an ole container, the functions provided are mainly implemented through several interfaces, including: IOleClientSite, IAdviseSink, and IOleInPlaceSite. The default Richedit does not seem to support location activation, to achieve the activation effect, you must support the last interface. To deal with clipboard and drag-and-drop Data, you must support the Unified Data Transmission Interface IDataObject.

 

The main reference object of this study is QQ. The goal is to support the paste format, animation ole controls, custom ole menus, drag-and-drop, text manipulation, and unified window/windowless support, I will list detailed outlines in the next article.

Done

OLE standards provide a large number of industrial standard interfaces and complicated interaction specifications. In fact, apart from Microsoft (taking the office series as a model), there are few full implementation software. It can be said that most of the work of MFC is used to implement OLE, so its bloated nature comes from this and has to be bloated. After I contacted wtl in earlier years, I found that MFC-WTL = OLE, there may be some printing and other facilities, but I don't think these are the main features. From my perspective, we can split the MFC into its collection class, print framework, COM support, OLE support, documentation/View/framework template (although it is rarely used now, mostly in the software field of the industry), process/thread/module status management, etc., are not bad, er ..., It seems that I have made it all over. Sorry, I have made another mistake. In fact, in my heart, I still don't want to give up, even if I haven't used it to develop commercial software for many years. I learned so much from MFC that I wouldn't say anything bad about it.

 

Again, I chose to extract code from MFC. I tried to use MFC directly and use static links so that I could not secretly tell others to avoid "damaging the image ". But I don't think I can do it because the entire MFC is tightly coupled. I don't want to or cannot use the entire framework to provide external services, so I have to make small wheels. I have also tried to implement it directly, but the workload is really not small. I am afraid that I can't wait, so I once again offered the housekeeping skills and pulled out a minimum kernel supporting OLE, after one or two weeks, I finally made it possible. So I wrote the opening section, and I need to figure out the whole idea later. The following is an example of inserting a browser that supports location activation:

 

This example is not descriptive, but used to test whether the minimum OLE kernel framework can work.

 

The test interface is as follows:

 

This article ends here! There are still a lot of idle talk and less dry work. I will try my best!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.