<?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>gabehabe</title>
	<atom:link href="http://www.gabehabe.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gabehabe.com/blog</link>
	<description>Cool blog, bro.</description>
	<lastBuildDate>Wed, 29 Jun 2011 01:26:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Boot Critical File C:\CI.dll is Corrupt</title>
		<link>http://www.gabehabe.com/blog/boot-critical-file-c-ci-dll-is-corrupt/</link>
		<comments>http://www.gabehabe.com/blog/boot-critical-file-c-ci-dll-is-corrupt/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 01:16:10 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Viruses]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[rootkit]]></category>
		<category><![CDATA[rootkit.win32.tdss]]></category>
		<category><![CDATA[tdss]]></category>
		<category><![CDATA[tdsskiller]]></category>
		<category><![CDATA[virus]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.gabehabe.com/blog/?p=188</guid>
		<description><![CDATA[Note: You&#8217;ll be glad to know that this issue is completely salvageable. Many forums suggest that a format &#038; reinstall is the only solution&#8230; How wrong they are. :) My God this has been driving me insane. I&#8217;ve had a few viruses in my time, but none as annoying as this. And yes&#8230; this is [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Note:</strong> You&#8217;ll be glad to know that this issue is <em>completely</em> salvageable.  Many forums suggest that a format &#038; reinstall is the only solution&#8230; How wrong they are. :)</p>
<p>My God this has been driving me insane.  I&#8217;ve had a few viruses in my time, but none as annoying as this.  And yes&#8230; this is a virus.  I&#8217;ve read speculations that it&#8217;s caused by Windows Update, and I believed this in the beginning.  However, a virus scan, specifically <strong>TDSSKiller</strong> (details further down), resolved the issue.</p>
<p>Right.  Yesterday, my laptop just shut down for no reason.  When I came to boot it back up, it went straight to startup repair, hung there for about 20-30 minutes and finally reported <strong>Boot Critical File C:\CI.dll is Corrupt</strong>&#8230; and startup repair was unable to repair it. (You know, that thing that startup <em>repair</em> should be able to do).</p>
<p>This was driving me around the bend. I couldn&#8217;t even boot to safe mode.  In the end, I loaded up my Linux partition and started doing a bit of research.</p>
<p><strong>Here&#8217;s the geeky bit.</strong>  <em>If you&#8217;re just interested in fixing it, scroll past the next paragraph.</em><br />
So it turns out that CI stands for <strong>Code Integrity</strong>. In layman&#8217;s terms, it&#8217;s a security layer that verifies that your programs have come from legitimate sources.  The virus in question happened to target that security layer, which just so happens to load every time you try to boot&#8230; even in safe mode.  You see the predicament?</p>
<p>Anyway, initially we just need to bypass it and get back into the system before we can fix it.  To get past it, turn on your computer and bash the F8 key until you get to the Advanced Boot Menu, which should look something like this:<br />
<img src='http://www.gabehabe.com/blog/wp-content/uploads/2011/06/W7-RE02.jpg' alt='Windows 7 Advanced Boot Menu' /></p>
<p>The one we want is the second option from bottom: <strong>Disable Driver Signature Enforcement</strong>.<br />
This should get you booted up into your system.  Note that you still can&#8217;t boot normally at this point.</p>
<p>After much more digging, I found that the malware belongs in a family called <strong>Rootkit.Win32.TDSS</strong>.  Fortunately, <a href='http://www.kaspersky.co.uk/' target='_blank'>Kaspersky</a> have made a handy little <strong>free tool</strong> to remove TDSS called <a href='http://www.filecluster.com/Antivirus-Spyware/Antivirus/Download-TDSSKiller.html' target='_blank'>TDSSKiller</a>.  I know&#8230; catchy, right?  And believe me, after the time I spent trying to figure this one out, I wanted nothing more than to kill it&#8230; <em>with fire</em>.  But then I&#8217;d probably have to buy a new laptop, and that would suck.</p>
<p>Well, that&#8217;s pretty much the long and short of it.  Once you&#8217;ve run the tool, it&#8217;ll detect the malware and remove it automatically.  Afterwards, you can reboot your system normally.</p>
<p><strong>Peace in the universe is once again restored.</strong></p>
<p>And, because I&#8217;m an all-round top bloke, I&#8217;ve taken the liberty to mirror the download, in case the download link above is ever broken for any reason.<br />
<a href='http://www.gabehabe.com/blog/wp-content/uploads/2011/06/tdsskiller.zip'>Download TDSSKiller</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gabehabe.com/blog/boot-critical-file-c-ci-dll-is-corrupt/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Windows 7 &#8211; I made it pretty!</title>
		<link>http://www.gabehabe.com/blog/windows-7-i-made-it-pretty/</link>
		<comments>http://www.gabehabe.com/blog/windows-7-i-made-it-pretty/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 21:47:02 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Customisation]]></category>
		<category><![CDATA[pretty]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://www.gabehabe.com/blog/?p=184</guid>
		<description><![CDATA[Well actually, someone else made it pretty, I just put it to use. I used the NautiKK theme for Windows 7 and this Glass CMD script. The theme itself requires a bit of effort, albeit very little. The instructions are included within the download but primarily, it comes down to taking ownership of files. I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>Well actually, someone else made it pretty, I just put it to use.</p>
<p>I used the <a href='http://djabytown.deviantart.com/art/nautiKK-visual-style-156258911' target='_blank'>NautiKK theme for Windows 7</a> and this <a href='http://komalo.deviantart.com/art/Glass-CMD-for-Vista-and-Seven-121457868' target='_blank'>Glass CMD</a> script.</p>
<p>The theme itself requires a bit of effort, albeit very little.  The instructions are included within the download but primarily, it comes down to <a href='http://www.blogsdna.com/2159/how-to-take-ownership-grant-permissions-to-access-files-folder-in-windows-7.htm' target='_blank'>taking ownership of files</a>. I&#8217;m too lazy to explain it, but the link will tell you how to do it.</p>
<p>Essentially, this post is just me taking a quick time out from coding <a href='http://www.gabehabe.com/blog/ohai-v2-wip/' target='_blank'>the new version of ohai!</a> (which is actually coming along very nicely) to show off my desktop.  So here it is!</p>
<p><a href='http://www.gabehabe.com/blog/wp-content/uploads/2010/11/screen.png' target='_blank'><img src='http://www.gabehabe.com/blog/wp-content/uploads/2010/11/screen.png' width='100%' alt='windows 7 dark theme' /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gabehabe.com/blog/windows-7-i-made-it-pretty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ohai! v2 &#8212; WIP</title>
		<link>http://www.gabehabe.com/blog/ohai-v2-wip/</link>
		<comments>http://www.gabehabe.com/blog/ohai-v2-wip/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 20:37:55 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[fat recursion]]></category>
		<category><![CDATA[ohai]]></category>

		<guid isPermaLink="false">http://www.gabehabe.com/blog/?p=180</guid>
		<description><![CDATA[So, on returning to my blog, I&#8217;ve decided to return to ohai!, too. It&#8217;s been a year since the initial release, with a total of 333 users so far, and between them sharing over 750 links and profiles! Many of you know that it was my first web project, and as a result, the code [...]]]></description>
			<content:encoded><![CDATA[<p>So, on returning to my blog, I&#8217;ve decided to return to <a href='http://ohai.im' target='_blank'>ohai!</a>, too.  It&#8217;s been a year since the initial release, with a total of 333 users so far, and between them sharing over 750 links and profiles!</p>
<p>Many of you know that it was my first web project, and as a result, the code is a total mess.  I&#8217;ll admit there are bugs, which I plan to iron out in the new version, as well as introducing a whole bunch of features, including a very simple API for displaying your contact details anywhere &#8212; contact pages on blogs, and even in forum signatures.</p>
<p>Stay tuned folks, it&#8217;s about time I started using the internet again, for more than just looking at funny pictures. Though the occasional funny picture is what makes the internet worth browsing.</p>
<p><img src='http://www.gabehabe.com/blog/wp-content/uploads/2010/11/fat-recursion-300x289.jpg' alt='fat recursion' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gabehabe.com/blog/ohai-v2-wip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>It&#8217;s about time I got back into this blogging thing.</title>
		<link>http://www.gabehabe.com/blog/its-about-time-i-got-back-into-this-blogging-thing/</link>
		<comments>http://www.gabehabe.com/blog/its-about-time-i-got-back-into-this-blogging-thing/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 17:37:15 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[sweet n sour]]></category>

		<guid isPermaLink="false">http://www.gabehabe.com/blog/?p=178</guid>
		<description><![CDATA[It&#8217;s been what, 7 months since my last entry? D: I&#8217;m going to attempt to update once a week. Can&#8217;t guarantee it, but I kinda miss the blogging stuff. I&#8217;ve installed a new theme and gotten rid of a whole bunch of plugins, so the site should load much faster. First entry coming up shortly&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been what, 7 months since my last entry? D:</p>
<p>I&#8217;m going to <em>attempt</em> to update once a week. Can&#8217;t guarantee it, but I kinda miss the blogging stuff.</p>
<p>I&#8217;ve installed a new theme and gotten rid of a whole bunch of plugins, so the site should load much faster.</p>
<p>First entry coming up shortly&#8230; after Chinese food. SWEET &#8216;n&#8217; SOOOUUUUURRRRR!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gabehabe.com/blog/its-about-time-i-got-back-into-this-blogging-thing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snippet Manager!</title>
		<link>http://www.gabehabe.com/blog/snippet-manager/</link>
		<comments>http://www.gabehabe.com/blog/snippet-manager/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 20:27:22 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Products]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[snippet manager]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.gabehabe.com/blog/snippet-manager/</guid>
		<description><![CDATA[So, I started this bloody ages ago and it kinda sorta got abandoned. :( BUT NOW IT&#8217;S BACK! And better than ever, with a plugin system which I just blogged about. :) Unfortunately, it is still windows only. I will build it for Linux some day, I promise! You can check it out here, I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>So, I started this bloody ages ago and it kinda sorta got abandoned. :( BUT NOW IT&#8217;S BACK! And better than ever, with a plugin system which I just blogged about. :)</p>
<p>Unfortunately, it is still windows only. I <strong>will</strong> build it for Linux some day, I promise!</p>
<p>You can check it out <a href='http://snip.gd' target='_blank'>here</a>, I&#8217;m rather pleased with it so far, even if the development is really really slow.</p>
<p><a href='http://snip.gd' target='_blank'><img src='http://snip.gd/img/screenshots/searching.png' alt='Free Snippet Manager Software Download' /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gabehabe.com/blog/snippet-manager/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>wxWidgets: Loading Symbols from a DLL (and using ::Connect)</title>
		<link>http://www.gabehabe.com/blog/wxwidgets-loading-symbols-from-a-dll-and-using-connect/</link>
		<comments>http://www.gabehabe.com/blog/wxwidgets-loading-symbols-from-a-dll-and-using-connect/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 20:20:08 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[wxWidgets]]></category>
		<category><![CDATA[c++]]></category>

		<guid isPermaLink="false">http://www.gabehabe.com/blog/wxwidgets-loading-symbols-from-a-dll-and-using-connect/</guid>
		<description><![CDATA[[Apologies if the entry is a little unclear, I just threw this together in about 10 minutes, I wanna get it out there... it's fucking hard to find any sort of information when it comes to this at the moment] Quick entry, gonna turn this into a tutorial soon. The code is a bit of [...]]]></description>
			<content:encoded><![CDATA[<p>[Apologies if the entry is a little unclear, I just threw this together in about 10 minutes, I wanna get it out there... it's fucking hard to find any sort of information when it comes to this at the moment]</p>
<p>Quick entry, gonna turn this into a tutorial soon. The code is a bit of a mess, since I was just throwing stuff together while I was figuring this out. I&#8217;ll tidy it up when it&#8217;s tutorial tiems.</p>
<p>Basically, I recently developed a [url=http://snip.gd/plugins.php]plugin system[/url] for my [url=http://snip.gd/]snippet manager[/url]. The way it works is simple: It loads symbols from a DLL into the application, which can be called from a dynamically created menu. First off, the main code [this is the messy bit for the time being]</p>
<p>This code opens a subdirectory within the working directory called &#8220;plugins&#8221;, and grabs all the DLLs from them. If the DLL contains a symbol called SnippetManagerPluginMain (the only required symbol for the plugins, I kept them simple) it will add it to the menu.</p>
<p>Additionally, it also checks for two optional optional symbols, which are pretty cool. They simply return strings, which assign the name and the keyboard shortcut for the plugin. If neither is set, it has no keyboard shortcut, and the name defaults to the name of the DLL file.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">    <span style="color: #666666;">/// &lt;plugin SYSTEM&gt; &lt;!-- ALPHA! --&gt;</span>
    <span style="color: #339900;">#if defined(__WXMSW__) // windows plugins - load ./plugins/*.dll</span>
    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>wxDir<span style="color: #008080;">::</span><span style="color: #007788;">Exists</span><span style="color: #008000;">&#40;</span>wxT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;./plugins/&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        wxDir plugin_dir<span style="color: #008000;">&#40;</span>wxT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;./plugins/&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>plugin_dir.<span style="color: #007788;">HasFiles</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
            wxArrayString files<span style="color: #008080;">;</span>
            wxDir<span style="color: #008080;">::</span><span style="color: #007788;">GetAllFiles</span><span style="color: #008000;">&#40;</span>wxT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;./plugins/&quot;</span><span style="color: #008000;">&#41;</span>, <span style="color: #000040;">&amp;</span>files<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            wxMenu<span style="color: #000040;">*</span> plugin_menu <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> wxMenu<span style="color: #008000;">&#40;</span>wxT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            wxDynamicLibrary<span style="color: #000040;">*</span> lib<span style="color: #008080;">;</span>
            wxString label<span style="color: #008080;">;</span>
            <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> ks<span style="color: #008080;">;</span>
            <span style="color: #0000ff;">bool</span> showmenu <span style="color: #000080;">=</span> <span style="color: #0000ff;">false</span><span style="color: #008080;">;</span>
            <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> files.<span style="color: #007788;">GetCount</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                lib <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> wxDynamicLibrary<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>files.<span style="color: #007788;">Item</span><span style="color: #008000;">&#40;</span>i<span style="color: #008000;">&#41;</span>.<span style="color: #007788;">Find</span><span style="color: #008000;">&#40;</span>wxT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;.dll&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                    lib<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Load<span style="color: #008000;">&#40;</span>files<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>lib<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>HasSymbol<span style="color: #008000;">&#40;</span>L<span style="color: #FF0000;">&quot;SnippetManagerPluginMain&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                        showmenu <span style="color: #000080;">=</span> <span style="color: #0000ff;">true</span><span style="color: #008080;">;</span>
                        <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>lib<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>HasSymbol<span style="color: #008000;">&#40;</span>L<span style="color: #FF0000;">&quot;SnippetManagerPluginName&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                            label <span style="color: #000080;">=</span> wxString<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>SnippetManagerPluginName<span style="color: #008000;">&#41;</span>lib<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>GetSymbol<span style="color: #008000;">&#40;</span>L<span style="color: #FF0000;">&quot;SnippetManagerPluginName&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, wxConvUTF8<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                        <span style="color: #008000;">&#125;</span> <span style="color: #0000ff;">else</span> <span style="color: #008000;">&#123;</span>
                            label <span style="color: #000080;">=</span> files<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">AfterFirst</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">'\<span style="color: #000099; font-weight: bold;">\'</span>).AfterFirst('</span>\\<span style="color: #FF0000;">').BeforeLast('</span>.<span style="color: #FF0000;">');
                        }
                        this-&gt;plugins.push_back((SnippetManagerPlugin)lib-&gt;GetSymbol(L&quot;SnippetManagerPluginMain&quot;));
&nbsp;
                        if(lib-&gt;HasSymbol(L&quot;SnippetManagerKeyboardShortcut&quot;)) {
                            ks = ((SnippetManagerKeyboardShortcut)lib-&gt;GetSymbol(L&quot;SnippetManagerKeyboardShortcut&quot;))();
                            label += L&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot; + wxString(ks, wxConvUTF8);
&nbsp;
                        }
                        plugin_menu-&gt;Append(wxID_PLUGIN + i, label);
                        Connect(wxID_PLUGIN + i, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Snippet_ManagerFrame::handle_plugin));
                    }
                }
            }
            if(showmenu) {
                mbar-&gt;Append(plugin_menu, wxT(&quot;&amp;Plugins&quot;));
            }
        }
    }
    #endif
    /// &lt;/plugin&gt;[</span></pre></div></div>

<p>In order to bind the events to the menu, the ::Connect method is called. This is an alternative to using EVENT_TABLE, and allows events to be allocated dynamically at runtime. wxID_PLUGIN is a custom variable, and basically, any of the menu items within the menu will call the main frame&#8217;s [il]handle_plugin[/il] method. The important part, however, is the fact that each one has a different ID, even though they use the same method.</p>
<p>The method itself then uses the ID of the event calling it to lookup the DLL&#8217;s symbol, which were added in <code>this->plugins</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">void</span> Snippet_ManagerFrame<span style="color: #008080;">::</span><span style="color: #007788;">handle_plugin</span><span style="color: #008000;">&#40;</span>wxCommandEvent <span style="color: #000040;">&amp;</span>e<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>plugins<span style="color: #008000;">&#91;</span>e.<span style="color: #007788;">GetId</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">-</span> wxID_PLUGIN<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#40;</span>this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>ui<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>uid.<span style="color: #007788;">mb_str</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, fill_p_snip<span style="color: #008000;">&#40;</span>this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>ui<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>get_active_stc<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>snip, this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>ui<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>get_active_stc<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>GetText<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Of course, some of the code here doesn&#8217;t really mean jack all, since there are custom methods and stuff used in it. But the base of it is clear. I&#8217;ll try to write another (small) application and a tutorial covering the steps over the weekend.</p>
<p>Until then, have fun! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gabehabe.com/blog/wxwidgets-loading-symbols-from-a-dll-and-using-connect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ohai!</title>
		<link>http://www.gabehabe.com/blog/ohai/</link>
		<comments>http://www.gabehabe.com/blog/ohai/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 19:55:22 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[ohai]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[websites]]></category>

		<guid isPermaLink="false">http://www.gabehabe.com/blog/?p=170</guid>
		<description><![CDATA[ohai, I&#8217;m gabehabe! So, I&#8217;ve spent the last three days working on a site. Three days of hard work has gone into it, and it&#8217;s ready for release. It&#8217;s a social portal. You can add links to all your profiles on social sites such as facebook, twitter and the like, as well as adding links [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ohai.im/gabehabe" target="_blank">ohai, I&#8217;m gabehabe!</a></p>
<p>So, I&#8217;ve spent the last three days working on a site. Three days of <strong>hard</strong> work has gone into it, and it&#8217;s ready for release.</p>
<p>It&#8217;s a social portal. You can add links to all your profiles on social sites such as facebook, twitter and the like, as well as adding links to your blog(s), or even just your favourite sites. Your profile is customisable, you can change all the colouring, add a profile picture, add a background picture, etc. There&#8217;s more customisation to come in the near future, but as the weekend draws to a close, I&#8217;ve gotten the core of the site up and running, ready to be released. There are a few profiles up and running smoothly already, please feel free to create your own. :)</p>
<p>Screenshot of a profile:<br />
<center><a href="http://ohai.im/gabehabe" target="_blank"><img src="http://www.gabehabe.com/blog/wp-content/uploads/2009/11/ohai.png" alt="ohai.im -- your personal portal" /></a></center></p>
<p>So what are you waiting for? Head on over to <a href="http://ohai.im" target="_blank">ohai.im</a> and <a href="http://ohai.im/register" target="_blank">register a free account</a> now! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gabehabe.com/blog/ohai/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Future of Input Devices</title>
		<link>http://www.gabehabe.com/blog/the-future-of-input-devices/</link>
		<comments>http://www.gabehabe.com/blog/the-future-of-input-devices/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 11:20:07 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tech News]]></category>
		<category><![CDATA[electromyography]]></category>
		<category><![CDATA[emg]]></category>
		<category><![CDATA[input devices]]></category>
		<category><![CDATA[just pure awesome]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.gabehabe.com/blog/?p=167</guid>
		<description><![CDATA[I had to post this, it&#8217;s awesome. The video explains it much better than I can, but it&#8217;s basically a new input system, developed to not require interfaces. Instead, it uses electromyography (EMG) sensors to translate muscle signals from the skin&#8217;s surface. The project is a joint collaboration between Microsoft, the University of Washington in [...]]]></description>
			<content:encoded><![CDATA[<p>I had to post this, it&#8217;s awesome. The video explains it much better than I can, but it&#8217;s basically a new input system, developed to not require interfaces. Instead, it uses electromyography (EMG) sensors to translate muscle signals from the skin&#8217;s surface. The project is a joint collaboration between Microsoft, the University of Washington in Seattle, and the University of Toronto in Canada.</p>
<p>The video shows a guy playing Guitar Hero with nothing more than an air guitar. (I&#8217;m sure there are dozens of amusing air guitar videos I could link to here, but I only ever find the idiots who take it seriously. Feel free to post a funny in the comments)</p>
<p>Final thoughts: What if you&#8217;ve <a href="http://abcnews.go.com/Technology/story?id=7112491" target="_blank">lost a finger</a>?</p>
<p><center><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/6_7BzUED39A&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/6_7BzUED39A&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gabehabe.com/blog/the-future-of-input-devices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wxWidgets: Threading, and using the Clipboard</title>
		<link>http://www.gabehabe.com/blog/wxwidgets-threading-and-using-the-clipboard/</link>
		<comments>http://www.gabehabe.com/blog/wxwidgets-threading-and-using-the-clipboard/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 17:11:12 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[wxWidgets]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[clipboard]]></category>
		<category><![CDATA[gui design]]></category>
		<category><![CDATA[threading]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.gabehabe.com/blog/wxwidgets-threading-and-using-the-clipboard/</guid>
		<description><![CDATA[wxWidgets: Threading, and using the Clipboard Two for one in this tutorial. We're going to create a thread using wxWidgets, and make it monitor the clipboard for text. Then, if we detect a change, we're going to add the new contents to a list. It's a relatively simple process, but unfortunately wxWidgets isn't the most [...]]]></description>
			<content:encoded><![CDATA[<h3>wxWidgets: Threading, and using the Clipboard</h3>

Two for one in this tutorial. We're going to create a thread using wxWidgets, and make it monitor the clipboard for text. Then, if we detect a change, we're going to add the new contents to a list.

It's a relatively simple process, but unfortunately wxWidgets isn't the most documented GUI toolkit out there.

So, let's get started. I'm gonna pile all the code into a single file instead of breaking my classes up into seperate files, just for ease of navigation in this tutorial. The code is relatively short anyway, with only 62 lines.

First off, as with any other program, we're going to want to get our includes done. We'll be needing three: The standard wx header, the clipboard header, and the thread header.


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;wx/wx.h&gt; // standard wx header</span>
<span style="color: #339900;">#include &lt;wx/clipbrd.h&gt; // clipboard - we'll monitor the clipboard for text</span>
<span style="color: #339900;">#include &lt;wx/thread.h&gt; // include threads!</span></pre></div></div>



The next thing we need to do is declare our <code>ClipLogger</code> class - this will inherit wxThread, and have two variables: One to hold the most recent text that we got from the clipboard, and one which is a pointer to a <code>wxListBox</code> object -- the object on the main window which we'll be updating.


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> ClipLogger <span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span> wxThread <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
        ClipLogger<span style="color: #008000;">&#40;</span>wxListBox<span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">private</span><span style="color: #008080;">:</span>
        <span style="color: #0000ff;">void</span><span style="color: #000040;">*</span> Entry<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// the entry point to the thread</span>
&nbsp;
        wxString LatestText<span style="color: #008080;">;</span> <span style="color: #666666;">// store the last text so we can check for changes</span>
        wxListBox<span style="color: #000040;">*</span> list<span style="color: #008080;">;</span> <span style="color: #666666;">// the list to update on a text change</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></pre></div></div>



The constructor is <em>very</em> simple. All it does is take a wxListBox*, and assign it to a variable stored by the class - this is the list that we want to update on clipboard text changes.


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">ClipLogger<span style="color: #008080;">::</span><span style="color: #007788;">ClipLogger</span><span style="color: #008000;">&#40;</span>wxListBox<span style="color: #000040;">*</span> l<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>list <span style="color: #000080;">=</span> l<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>



Next up is the main part of this tutorial. When we create a thread, we need to override the <code>Entry()</code> method of the class, like so:


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">void</span><span style="color: #000040;">*</span> ClipLogger<span style="color: #008080;">::</span><span style="color: #007788;">Entry</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span></pre></div></div>



To save time and memory, rather than creating a variable every time we loop, we'll create it before and simply overwrite it inside the loop.


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">wxTextDataObject temp<span style="color: #008080;">;</span></pre></div></div>



wxTextDataObject is the type of object that the clipboard will store.
Next, since our thread is a constant "monitor" for the clipboard, we want it to loop.


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">true</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span></pre></div></div>



Then, we need to think about how we can help our application not be CPU-hungry. The simple solution is to make the thread sleep each time it loops. We can do this with <code>wxSleep(int time)</code>, where time is the length of time to sleep in <strong>seconds</strong>.


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">wxSleep<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>



The rest of the loop is the clipboard. It's very simple, so rather than break it up line-by-line, I've added comments along the way. We basically need to do the following:
 - Open the clipboard
 - If the clipboard is text, get it into our <code>temp</code> variable
 - Update the list and remember this is the most recent (so as not to constantly add the same data to the list)
 - Close the clipboard


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>wxTheClipboard<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Open<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">// try to open the clipboard</span>
            <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>wxTheClipboard<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>IsSupported<span style="color: #008000;">&#40;</span>wxDF_TEXT<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">// if the clipboard contains text</span>
                wxTheClipboard<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>GetData<span style="color: #008000;">&#40;</span>temp<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// get the data from the clipboard</span>
                <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>LatestText <span style="color: #000040;">!</span><span style="color: #000080;">=</span> temp.<span style="color: #007788;">GetText</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">// if it's changed, we want to update</span>
                    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>temp.<span style="color: #007788;">GetText</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> wxT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">// if it's not an empty string</span>
                        this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>LatestText <span style="color: #000080;">=</span> temp.<span style="color: #007788;">GetText</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>  <span style="color: #666666;">// update the &quot;LatestText&quot;</span>
                        this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>list<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Append<span style="color: #008000;">&#40;</span>temp.<span style="color: #007788;">GetText</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// append to the list</span>
                    <span style="color: #008000;">&#125;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        wxTheClipboard<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Close<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// close the clipboard</span></pre></div></div>



The last thing left to do in the thread is simply close it off, and close off the loop.


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>



Simple, huh? :)

And that's our thread defined. Now all we need to do is create the app itself, which is a simple process. I hope that you already know how to do it, so we can blitz through the majority of it.

Create the app:


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> threaded_app <span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span> wxApp <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
        <span style="color: #0000ff;">bool</span> OnInit<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></pre></div></div>



The beginning of the <code>OnInit()</code> should be nothing new at this point either.


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">bool</span> threaded_app<span style="color: #008080;">::</span><span style="color: #007788;">OnInit</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">// quickly create a wxFrame to display a window</span>
    wxFrame<span style="color: #000040;">*</span> f <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> wxFrame<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span>, wxID_ANY, wxT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;Threaded App!&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// add a list to the frame we created</span>
    wxListBox<span style="color: #000040;">*</span> list <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> wxListBox<span style="color: #008000;">&#40;</span>f, wxID_ANY<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// display the frame</span>
    f<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Show<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>



The last part of <code>OnInit()</code> that we need to do is actually create an instance of our thread and run it, like so:


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">    <span style="color: #666666;">// pass the list to the clipboard monitor so it knows what to update</span>
    ClipLogger<span style="color: #000040;">*</span> cl <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> ClipLogger<span style="color: #008000;">&#40;</span>list<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// construct our thread</span>
    cl<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Create<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// we have to create a thread before we can run it</span>
    cl<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Run<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// run our thread</span></pre></div></div>



And we can simply finish off the <code>OnInit()</code> and IMPLEMENT_APP:


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">    <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
IMPLEMENT_APP<span style="color: #008000;">&#40;</span>threaded_app<span style="color: #008000;">&#41;</span></pre></div></div>




And that's all there is to threading and using the clipboard in wxWidgets!

Here's the complete code:


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;wx/wx.h&gt; // standard wx header</span>
<span style="color: #339900;">#include &lt;wx/clipbrd.h&gt; // clipboard - we'll monitor the clipboard for text</span>
<span style="color: #339900;">#include &lt;wx/thread.h&gt; // include threads!</span>
&nbsp;
<span style="color: #0000ff;">class</span> ClipLogger <span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span> wxThread <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
        ClipLogger<span style="color: #008000;">&#40;</span>wxListBox<span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">private</span><span style="color: #008080;">:</span>
        <span style="color: #0000ff;">void</span><span style="color: #000040;">*</span> Entry<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// the entry point to the thread</span>
&nbsp;
        wxString LatestText<span style="color: #008080;">;</span> <span style="color: #666666;">// store the last text so we can check for changes</span>
        wxListBox<span style="color: #000040;">*</span> list<span style="color: #008080;">;</span> <span style="color: #666666;">// the list to update on a text change</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
ClipLogger<span style="color: #008080;">::</span><span style="color: #007788;">ClipLogger</span><span style="color: #008000;">&#40;</span>wxListBox<span style="color: #000040;">*</span> l<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>list <span style="color: #000080;">=</span> l<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span><span style="color: #000040;">*</span> ClipLogger<span style="color: #008080;">::</span><span style="color: #007788;">Entry</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    wxTextDataObject temp<span style="color: #008080;">;</span> <span style="color: #666666;">// create a &quot;wxTextDataObject&quot; to get the info from the clipboard</span>
    <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">true</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">// our thread will loop</span>
        wxSleep<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// sleep for 1 second, make the thread less cpu-hungry</span>
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>wxTheClipboard<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Open<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">// try to open the clipboard</span>
            <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>wxTheClipboard<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>IsSupported<span style="color: #008000;">&#40;</span>wxDF_TEXT<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">// if the clipboard contains text</span>
                wxTheClipboard<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>GetData<span style="color: #008000;">&#40;</span>temp<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// get the data from the clipboard</span>
                <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>LatestText <span style="color: #000040;">!</span><span style="color: #000080;">=</span> temp.<span style="color: #007788;">GetText</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">// if it's changed, we want to update</span>
                    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>temp.<span style="color: #007788;">GetText</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> wxT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">// if it's not an empty string</span>
                        this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>LatestText <span style="color: #000080;">=</span> temp.<span style="color: #007788;">GetText</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>  <span style="color: #666666;">// update the &quot;LatestText&quot;</span>
                        this<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>list<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Append<span style="color: #008000;">&#40;</span>temp.<span style="color: #007788;">GetText</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// append to the list</span>
                    <span style="color: #008000;">&#125;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        wxTheClipboard<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Close<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// close the clipboard</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">class</span> threaded_app <span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span> wxApp <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
        <span style="color: #0000ff;">bool</span> OnInit<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">bool</span> threaded_app<span style="color: #008080;">::</span><span style="color: #007788;">OnInit</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">// quickly create a wxFrame to display a window</span>
    wxFrame<span style="color: #000040;">*</span> f <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> wxFrame<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span>, wxID_ANY, wxT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;Threaded App!&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// add a list to the frame we created</span>
    wxListBox<span style="color: #000040;">*</span> list <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> wxListBox<span style="color: #008000;">&#40;</span>f, wxID_ANY<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// display the frame</span>
    f<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Show<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// pass the list to the clipboard monitor so it knows what to update</span>
    ClipLogger<span style="color: #000040;">*</span> cl <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> ClipLogger<span style="color: #008000;">&#40;</span>list<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// construct our thread</span>
    cl<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Create<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// we have to create a thread before we can run it</span>
    cl<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Run<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// run our thread</span>
&nbsp;
    <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
IMPLEMENT_APP<span style="color: #008000;">&#40;</span>threaded_app<span style="color: #008000;">&#41;</span></pre></div></div>



Happy coding! :)

]]></content:encoded>
			<wfw:commentRss>http://www.gabehabe.com/blog/wxwidgets-threading-and-using-the-clipboard/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Google Chrome &#8211; Unknown Plugin: lolwut?</title>
		<link>http://www.gabehabe.com/blog/google-chrome-unknown-plugin-lolwut/</link>
		<comments>http://www.gabehabe.com/blog/google-chrome-unknown-plugin-lolwut/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 17:37:44 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[WTF]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google chrome]]></category>
		<category><![CDATA[lol]]></category>
		<category><![CDATA[lolwut]]></category>

		<guid isPermaLink="false">http://www.gabehabe.com/blog/?p=149</guid>
		<description><![CDATA[I certainly less than three google chrome, and today it proved just how great it is &#8211; even though it doesn&#8217;t know which plugin is unresponsive, it knows which one to kill!]]></description>
			<content:encoded><![CDATA[<p>I certainly less than three <a href="http://code.google.com/p/chromium/issues/detail?id=18385" target="_blank">google chrome</a>, and today it proved just how great it is &ndash; even though it doesn&#8217;t know which plugin is unresponsive, it knows which one to kill!</p>
<p><center><img src="http://www.gabehabe.com/blog/wp-content/uploads/2009/10/chrome-unresponsive-plugin.jpg" alt="chrome kill unknown plugin" /></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gabehabe.com/blog/google-chrome-unknown-plugin-lolwut/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

