<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Using C# in your Windows Vista Sidebar gadgets</title>
	<atom:link href="http://www.heuristicism.ca/2007/02/14/using-c-in-your-windows-vista-sidebar-gadgets/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.heuristicism.ca/2007/02/14/using-c-in-your-windows-vista-sidebar-gadgets/</link>
	<description>life is one big tradeoff</description>
	<lastBuildDate>Fri, 27 Aug 2010 06:42:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Aditya</title>
		<link>http://www.heuristicism.ca/2007/02/14/using-c-in-your-windows-vista-sidebar-gadgets/comment-page-1/#comment-35</link>
		<dc:creator>Aditya</dc:creator>
		<pubDate>Thu, 19 Mar 2009 06:43:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.heuristicism.ca/?p=6#comment-35</guid>
		<description>That sounds a bit out of my area of expertise, and it&#039;s been a long time since I&#039;ve done anything remotely COM-related.  What do you get when you google the error code?</description>
		<content:encoded><![CDATA[<p>That sounds a bit out of my area of expertise, and it&#8217;s been a long time since I&#8217;ve done anything remotely COM-related.  What do you get when you google the error code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shreyas</title>
		<link>http://www.heuristicism.ca/2007/02/14/using-c-in-your-windows-vista-sidebar-gadgets/comment-page-1/#comment-34</link>
		<dc:creator>shreyas</dc:creator>
		<pubDate>Wed, 18 Mar 2009 13:23:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.heuristicism.ca/?p=6#comment-34</guid>
		<description>Hi,

I tried Using C# Code in Vista gadget as you mentioned in your blog, below is the Wrapper class which i created for User32.dll

using System;
using System.Runtime.InteropServices;

namespace CheckDesktop
{
    [ComVisible(true)]
    public class CheckWindow
    {
        [DllImport(&quot;user32.dll&quot;, EntryPoint = &quot;GetDesktopWindow&quot;, SetLastError = true)]
        public static extern IntPtr GetDesktopWindow();

        [DllImport(&quot;user32.dll&quot;, EntryPoint = &quot;GetForegroundWindow&quot;, SetLastError = true)]
        public static extern IntPtr GetForegroundWindow();

    }
}

And i created the ActiveX object for using this in gadget Javascript as follows:

var wrapper;
    wrapper = new ActiveXObject(&quot;CheckDesktop.CheckWindow&quot;);   

Also I have registered the CheckDesktop DLL, but my code goes in exception when the ActiveXObject is created and i am not able to resolve it as i am not getting any Error Description, i am getting just an error code.

Please help,
Thanks,
Shreyas</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I tried Using C# Code in Vista gadget as you mentioned in your blog, below is the Wrapper class which i created for User32.dll</p>
<p>using System;<br />
using System.Runtime.InteropServices;</p>
<p>namespace CheckDesktop<br />
{<br />
    [ComVisible(true)]<br />
    public class CheckWindow<br />
    {<br />
        [DllImport("user32.dll", EntryPoint = "GetDesktopWindow", SetLastError = true)]<br />
        public static extern IntPtr GetDesktopWindow();</p>
<p>        [DllImport("user32.dll", EntryPoint = "GetForegroundWindow", SetLastError = true)]<br />
        public static extern IntPtr GetForegroundWindow();</p>
<p>    }<br />
}</p>
<p>And i created the ActiveX object for using this in gadget Javascript as follows:</p>
<p>var wrapper;<br />
    wrapper = new ActiveXObject(&#8220;CheckDesktop.CheckWindow&#8221;);   </p>
<p>Also I have registered the CheckDesktop DLL, but my code goes in exception when the ActiveXObject is created and i am not able to resolve it as i am not getting any Error Description, i am getting just an error code.</p>
<p>Please help,<br />
Thanks,<br />
Shreyas</p>
]]></content:encoded>
	</item>
</channel>
</rss>
