<?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>Roundtrip to Shanghai via Tokyo &#187; windows</title>
	<atom:link href="http://kohei.us/tag/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://kohei.us</link>
	<description>Kohei Yoshida&#039;s Webspace</description>
	<lastBuildDate>Tue, 22 May 2012 04:18:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Windows clipboard dumper</title>
		<link>http://kohei.us/2011/12/01/windows-clipboard-dumper/</link>
		<comments>http://kohei.us/2011/12/01/windows-clipboard-dumper/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 03:40:47 +0000</pubDate>
		<dc:creator>Kohei Yoshida</dc:creator>
				<category><![CDATA[]]></category>
		<category><![CDATA[code snippet]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://kohei.us/?p=1292</guid>
		<description><![CDATA[Inspired by this bug report, I just wrote a small, quick and dirty utility to dump the current clipboard content on Windows. Windows development to me is still pretty much an uncharted territory, so even a utility as simple as &#8230; <a href="http://kohei.us/2011/12/01/windows-clipboard-dumper/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Inspired by <a href="https://bugs.freedesktop.org/show_bug.cgi?id=33100">this bug report</a>, I just wrote a small, quick and dirty utility to dump the current clipboard content on Windows.  Windows development to me is still pretty much an uncharted territory, so even a utility as simple as this took me some time.  Anyway, you can download the binary from here: <a href='http://kohei.us/wp-content/uploads/2011/12/clipdump.exe'>clipdump.exe</a>.  Note that this is a console utility, so you need to run this from the console window.</p>
<p>Here is the source code.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;Windows.h&gt;</span>
&nbsp;
<span style="color: #339900;">#include &lt;cstdio&gt;</span>
<span style="color: #339900;">#include &lt;cstdlib&gt;</span>
<span style="color: #339900;">#include &lt;iostream&gt;</span>
<span style="color: #339900;">#include &lt;vector&gt;</span>
&nbsp;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> std<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">size_t</span> char_per_line <span style="color: #000080;">=</span> <span style="color: #0000dd;">16</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">typedef</span> vector<span style="color: #000080;">&lt;</span>WORD<span style="color: #000080;">&gt;</span> line_store_type<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">void</span> dump_line<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> line_store_type<span style="color: #000040;">&amp;</span> line<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>line.<span style="color: #007788;">empty</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #0000ff;">size_t</span> fill_size <span style="color: #000080;">=</span> char_per_line <span style="color: #000040;">-</span> line.<span style="color: #007788;">size</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    line_store_type<span style="color: #008080;">::</span><span style="color: #007788;">const_iterator</span> i <span style="color: #000080;">=</span> line.<span style="color: #007788;">begin</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, iend <span style="color: #000080;">=</span> line.<span style="color: #007788;">end</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #008080;">;</span> i <span style="color: #000040;">!</span><span style="color: #000080;">=</span> iend<span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i<span style="color: #008000;">&#41;</span>
        <span style="color: #0000dd;">printf</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;%04X &quot;</span>, <span style="color: #000040;">*</span>i<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span>fill_size<span style="color: #000040;">--</span><span style="color: #008000;">&#41;</span>
        <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;     &quot;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">' '</span><span style="color: #008080;">;</span>
    i <span style="color: #000080;">=</span> line.<span style="color: #007788;">begin</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #008080;">;</span> i <span style="color: #000040;">!</span><span style="color: #000080;">=</span> iend<span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        WORD c <span style="color: #000080;">=</span> <span style="color: #000040;">*</span>i<span style="color: #008080;">;</span>
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">32</span> <span style="color: #000080;">&lt;=</span> c <span style="color: #000040;">&amp;&amp;</span> c <span style="color: #000080;">&lt;=</span> <span style="color: #0000dd;">126</span><span style="color: #008000;">&#41;</span>
            <span style="color: #666666;">// ASCII printable range</span>
            <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #0000ff;">static_cast</span><span style="color: #000080;">&lt;</span><span style="color: #0000ff;">char</span><span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span>c<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">else</span>
            <span style="color: #666666;">// non-printable range</span>
            <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">'.'</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> dump_clip<span style="color: #008000;">&#40;</span>HANDLE hdl<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>hdl<span style="color: #008000;">&#41;</span>
        <span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
&nbsp;
    LPTSTR buf <span style="color: #000080;">=</span> <span style="color: #0000ff;">static_cast</span><span style="color: #000080;">&lt;</span>LPTSTR<span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span>GlobalLock<span style="color: #008000;">&#40;</span>hdl<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><span style="color: #000040;">!</span>buf<span style="color: #008000;">&#41;</span>
        <span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
&nbsp;
    line_store_type line<span style="color: #008080;">;</span>
    line.<span style="color: #007788;">reserve</span><span style="color: #008000;">&#40;</span>char_per_line<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">size_t</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span>, n <span style="color: #000080;">=</span> GlobalSize<span style="color: #008000;">&#40;</span>hdl<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> n<span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        line.<span style="color: #007788;">push_back</span><span style="color: #008000;">&#40;</span>buf<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>line.<span style="color: #007788;">size</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> char_per_line<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            dump_line<span style="color: #008000;">&#40;</span>line<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            line.<span style="color: #007788;">clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
    dump_line<span style="color: #008000;">&#40;</span>line<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    GlobalUnlock<span style="color: #008000;">&#40;</span>hdl<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>OpenClipboard<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">EXIT_FAILURE</span><span style="color: #008080;">;</span>
&nbsp;
    UINT fmt <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span>fmt <span style="color: #000080;">=</span> EnumClipboardFormats<span style="color: #008000;">&#40;</span>fmt<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> fmt<span style="color: #008080;">;</span> fmt <span style="color: #000080;">=</span> EnumClipboardFormats<span style="color: #008000;">&#40;</span>fmt<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">char</span> name<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">100</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">int</span> len <span style="color: #000080;">=</span> GetClipboardFormatName<span style="color: #008000;">&#40;</span>fmt, name, <span style="color: #0000dd;">100</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>len<span style="color: #008000;">&#41;</span>
            <span style="color: #0000ff;">continue</span><span style="color: #008080;">;</span>
&nbsp;
        <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;---&quot;</span> <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
        <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;format code: &quot;</span> <span style="color: #000080;">&lt;&lt;</span> fmt <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
        <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;name: &quot;</span> <span style="color: #000080;">&lt;&lt;</span> name <span style="color: #000080;">&lt;&lt;</span> endl <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
&nbsp;
        HANDLE hdl <span style="color: #000080;">=</span> GetClipboardData<span style="color: #008000;">&#40;</span>fmt<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        dump_clip<span style="color: #008000;">&#40;</span>hdl<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    CloseClipboard<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">EXIT_SUCCESS</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>It&#8217;s nothing sophisticated, and it could probably use more polishing and perhaps some GUI (since it&#8217;s a Windows app).  But for now it serves the purpose for me.</p>
<p><strong>Update:</strong><br />
Tor has submitted his version in the comment section.  Much more sophisticated than mine (and it&#8217;s C not C++).</p>
]]></content:encoded>
			<wfw:commentRss>http://kohei.us/2011/12/01/windows-clipboard-dumper/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Strace equivalent for Windows</title>
		<link>http://kohei.us/2010/06/25/strace-equivalent-for-windows/</link>
		<comments>http://kohei.us/2010/06/25/strace-equivalent-for-windows/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 20:45:36 +0000</pubDate>
		<dc:creator>Kohei Yoshida</dc:creator>
				<category><![CDATA[]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://kohei.us/?p=801</guid>
		<description><![CDATA[While searching for a debug tool equivalent of strace that runs on Windows, I&#8217;ve come across Process Monitor. This appears to work well for me. For anyone in search of strace equivalent on Windows, give this one a try. I&#8217;ve &#8230; <a href="http://kohei.us/2010/06/25/strace-equivalent-for-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>While searching for a debug tool equivalent of <a href="http://en.wikipedia.org/wiki/Strace">strace</a> that runs on Windows, I&#8217;ve come across <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx">Process Monitor</a>.  This appears to work well for me.  For anyone in search of strace equivalent on Windows, give this one a try.</p>
<p>I&#8217;ve also tried <a href="http://www.intellectualheaven.com/default.asp?BH=projects&#038;H=strace.htm">StraceNT</a>, but this one was not very reliable as it tends to crash the traced process almost every time.</p>
<p>An equally useful tool for debugging on Windows is <a href="http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx">DebugView</a>, which captures output from the <a href="http://msdn.microsoft.com/en-us/library/aa363362%28VS.85%29.aspx">OutputDebugString</a> calls.</p>
]]></content:encoded>
			<wfw:commentRss>http://kohei.us/2010/06/25/strace-equivalent-for-windows/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Git on Windows</title>
		<link>http://kohei.us/2010/01/20/git-on-windows/</link>
		<comments>http://kohei.us/2010/01/20/git-on-windows/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 01:54:37 +0000</pubDate>
		<dc:creator>Kohei Yoshida</dc:creator>
				<category><![CDATA[]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[mingw]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://kohei.us/?p=619</guid>
		<description><![CDATA[I guess I don&#8217;t really have to tell the world about this, since if you type the title of this blog post in Google it will come back as the top hit. But it&#8217;s still worth mentioning msysgit, a pretty &#8230; <a href="http://kohei.us/2010/01/20/git-on-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I guess I don&#8217;t really have to tell the world about this, since if you type the title of this blog post in Google it will come back as the top hit.  But it&#8217;s still worth mentioning <a href="http://code.google.com/p/msysgit/">msysgit</a>, a pretty darn good <a href="http://git-scm.com/">git</a> client on Windows.  It&#8217;s small, it&#8217;s efficient, and it&#8217;s git. :-)  You could of course use git in <a href="http://www.cygwin.com/">cygwin</a>, but git in cygwin feels a little &#8220;heavy&#8221; and by no means small, since you have to get the whole cygwin environment to even use git.  So, if you don&#8217;t already have cygwin, and want to use git on Windows, msysgit is a pretty good choice.  It comes with a minimal bash shell, and while I&#8217;m happy to see <a href="http://www.openssh.com/">ssh</a> included with its shell, I was a little disappointed that they left out <a href="http://samba.anu.edu.au/rsync/">rsync</a>.  But that&#8217;s just one minor downside.</p>
<p>For me, msysgit is my git client of choice on Windows, especially in a virtual machine setting where the disk space is tight.  On a build machine, though, I still use git in cygwin since I already have to use cygwin to build OOo.</p>
]]></content:encoded>
			<wfw:commentRss>http://kohei.us/2010/01/20/git-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calc Solver release</title>
		<link>http://kohei.us/2007/11/25/calc-solver-release/</link>
		<comments>http://kohei.us/2007/11/25/calc-solver-release/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 22:10:18 +0000</pubDate>
		<dc:creator>Kohei Yoshida</dc:creator>
				<category><![CDATA[]]></category>
		<category><![CDATA[calc]]></category>
		<category><![CDATA[go-oo]]></category>
		<category><![CDATA[openoffice.org]]></category>
		<category><![CDATA[scsolver]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://kohei.us/2007/11/25/calc-solver-release/</guid>
		<description><![CDATA[I just released a new version of Calc Solver after more than a year since the last release. A lot of effort has gone into this release mostly to re-package it as a true UNO extension, and also to make &#8230; <a href="http://kohei.us/2007/11/25/calc-solver-release/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just released a new version of <a href="http://kohei.us/ooo/solver/">Calc Solver</a> after more than a year since the last release.  A lot of effort has gone into this release mostly to re-package it as a true UNO extension, and also to <strong>make it available for the Windows version of OO.o</strong> beginning with this release.</p>
<p><strong>The UI has been localized for French and Japanese</strong>, thanks to <a href="http://blogs.nuxeo.com/sections/blogs/laurent_godard">Laurent Godard</a> and <a href="http://openoffice.exblog.jp/">Kazunari Hirano</a>.  Laurent also helped me on various UNO related issues, so I would really like to acknowledge his help.  Thank you Laurent. :-)  The system language should be automatically picked up and the appropriate translation texts should be displayed for English, French and Japanese.  If this doesn&#8217;t work for you, please let me know.</p>
<p>The ride was quite bumpy, however, to get Solver to build on Windows.  Since this was my first attempt to build anything non-trivial on Windows, I had to spend a few days (and nights) studying how the MSVC compiler works so that I could build a DLL.  There was also an issue with multi-thread vs single-thread libraries, so I had to manually select the default libraries to be all single-threaded for the Solver as well as the lpsolve code.  Not to mention I didn&#8217;t know how to set up a build environment since GNU make in cygwin didn&#8217;t work too reliably due to file path separator and the driver letter issues.  In the end, I came up with a custom DOS batch script with everything hardcoded to semi-automate the build process, but that&#8217;s far from being elegant.  I&#8217;m just wondering if there is any better way to set up a build environment on Windows&#8230;  <strong>Question: what do Windows developers use these days to build C++ projects?</strong></p>
<p>On the Linux side, the Solver extension installed and worked fine, but I&#8217;ve experienced a major problem with installing it in the Extension Manager UI.  But as long as it&#8217;s installed from the command line using unopkg, it works fine.  I still haven&#8217;t figured out why installing with the Extension Manager caused a problem but installing with unopkg didn&#8217;t.</p>
<p>Oh I almost forgot.  <strong>If you use <a href="http://go-oo.org/">Go-oo version of OO.o (aka ooo-build)</a> or any variant of it with my Solver already included, you don&#8217;t need to install this extension.</strong>  It&#8217;s already there in <strong>Tools &#8211; Solver</strong>.</p>
<p>Anyway, enough talk.  Enjoy! :-)  And please report me any problems you may experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://kohei.us/2007/11/25/calc-solver-release/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

