[Ie programming] Turn On/Off IE8 cursor browsing mode (caret browsing)

Source: Internet
Author: User

The caret browsing mode is a new feature of IE8. After entering this mode, a cursor similar to the input in Notepad appears on the page, you can use the keyboard (press shift or Alt + direction key) to accurately select the page text. In IE8, the shortcut for enabling/disabling the cursor browsing mode is F7.

 

So how can we program to enable/disable the caret browsing mode? The answer is:Run the idm_caretbrowsingmode command through iolecommandtarget..

 

The following sample code demonstrates how to enable and disable caret browsing:

Iolecommandtarget * pcmdtarg = NULL;
HR = pwebbrowser-> QueryInterface (iid_iolecommandtarget, (void **) & pcmdtarg); // pass {
Track ('ctl00 _ maincontentcontainer_ctl00 | ctl00_maincontentcontainer_ctl12 ', this );
} "Href =" http://msdn.microsoft.com/en-us/library/aa752127 (vs.85). aspx "> iwebbrowser2 o {
Track ('ctl00 _ maincontentcontainer_ctl00 | ctl00_maincontentcontainer_ctl13 ', this );
} "Href =" http://msdn.microsoft.com/en-us/library/aa752574 (vs.85). aspx "> ihtmldocument2 can get iolecommandtarget Interface

Pcmdtarg-> exec (& cgid_mshtml, idm_caretbrowsingmode, olecmdexecopt_dodefault, null, null); // switch the enable/disable Mode

 

 

How can I query whether caret browsing is enabled or disabled?The following sample code queries the status of caret browsing:

 

Olecmd rgcmd = {idm_caretbrowsingmode, 0 };

Pcmdtarg-> querystatus (& cgid_mshtml, 1, & rgcmd, null); // query the status

Bool biscaretbrowsing = (rgcmd. cmdf & (olecmdf_enabled & olecmdf_latched )! = 0 );

 

> Original article copyright belongs to the author, reprint please indicate the source (http://blog.csdn.net/WinGeek/), thank you. <

 

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.