<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Matt J. Wilson &#187; Internet Explorer</title>
	<atom:link href="http://www.mattjwilson.com/blog/tag/internet-explorer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattjwilson.com/blog</link>
	<description>General ramblings, programming frustrations, and complete randomness.  Have questions? E-mail me.</description>
	<lastBuildDate>Tue, 19 Jan 2010 19:37:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Exposing SHDocVw</title>
		<link>http://www.mattjwilson.com/blog/2009/03/04/exposing-shdocvw/</link>
		<comments>http://www.mattjwilson.com/blog/2009/03/04/exposing-shdocvw/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 20:20:12 +0000</pubDate>
		<dc:creator>Matt J. Wilson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[SHDocVw]]></category>

		<guid isPermaLink="false">http://www.mattjwilson.com/blog/2009/03/04/exposing-shdocvw/</guid>
		<description><![CDATA[A WebBrowserClass is just used for viewing pages embedded inside a .NET form and that&#8217;s about it, right?  The SHDocVw namespace can actually perform a ridiculous amount of neat features and override a lot of settings for something like an internet explorer add-on: getting the selected text of the browser, rewriting some of the content [...]]]></description>
			<content:encoded><![CDATA[<p>A WebBrowserClass is just used for viewing pages embedded inside a .NET form and that&#8217;s about it, right?  The SHDocVw namespace can actually perform a ridiculous amount of neat features and override a lot of settings for something like an internet explorer add-on: getting the selected text of the browser, rewriting some of the content page (yes, you read that correctly; you can completely change the HTML of the page, including replacing text and/or images), setting the value of a selected field to something else, etc.</p>
<p>Want to set the user&#8217;s currently selected INPUT field to something?  Here&#8217;s a snippet for that:</p>
<pre class="brush: csharp;">try
{
mshtml.IHTMLDocument2 doc2 = (mshtml.IHTMLDocument2)Explorer.Document;

mshtml.IHTMLElement selobj = null;
mshtml.IHTMLTxtRange range = null;

if ((doc2 == null) || (doc2.activeElement == null))
return;

selobj = doc2.activeElement as mshtml.IHTMLElement;
if (selobj == null)
return;

selobj.setAttribute(&quot;value&quot;, &quot;I just set your value.&quot;, 0);

return;
}
catch (Exception exc)
{
}
</pre>
<p>Want to handle some events, like the mouse selection changing?  Here&#8217;s a snippet for that:</p>
<pre class="brush: csharp;">
m_iEvent.onselectionchange += new mshtml.HTMLDocumentEvents2_onselectionchangeEventHandler(m_iEvent_onselectionchange);
</pre>
<p>So far, I&#8217;ve been really impressed with the amount of flexibility (whether intended or not) is readily available in this class.  If anyone is interested, I can also demonstrate similar functionality using XUL/Javascript for FireFox add-ons.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjwilson.com/blog/2009/03/04/exposing-shdocvw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

