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. <