<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss version="2.0"><channel><title>poiru.net</title><link>http://poiru.net</link><description>By Birunthan Mohanathas.</description><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/poirunet" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="poirunet" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>Menu button arrow with raw Win32</title><link>http://poiru.net/2012/06/17/win32-menu-button</link><guid isPermaLink="false">/2012/06/17/win32-menu-button</guid><pubDate>Sun, 17 Jun 2012 20:50:00 EEST</pubDate><description>&lt;p&gt;MFC has the CMFCMenuButton class to create menu buttons, but the raw Win32 API
only provides split buttons (and even that only on Vista and later). To create a
simple button with an arrow on the right, I only found complex solutions which
involved owner-drawing the entire button by hand.&lt;/p&gt;

&lt;p&gt;I decided to use a far simpler approach that makes use of the standard Win32
button control and is compatibile with all versions of Windows.&lt;/p&gt;

&lt;p&gt;First, we define a subclass procedure that will handle &lt;code&gt;WM_PAINT&lt;/code&gt; and draw the arrow
on the right of the button. Note that the example uses the ComCtl32.dll version 6
subclassing approach, but it should be trivial to modify it to target earlier versions
of Common Controls library if needed. Also note that an undocumented flag is used, which
may or may not cause issues in the future.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;LRESULT CALLBACK MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
    switch (uMsg)
    {
    case WM_PAINT:
        {
            LRESULT result = DefSubclassProc(hWnd, uMsg, wParam, lParam);

            RECT buttonRect;
            GetClientRect(hWnd, &amp;amp;buttonRect);
            int arrowX = buttonRect.right - 18;
            int arroyY = buttonRect.top + 4;
            RECT arrowRect = { arrowX, arroyY, arrowX + 14, arroyY + 14 };      

            // Draw arrow on top of the button
            HDC dc = GetDC(hWnd);
            const UINT DFCS_MENUARROWDOWN = 0x0010; // Undocumented 
            DWORD drawFlags = DFCS_TRANSPARENT | DFCS_MENUARROWDOWN | (IsWindowEnabled(hWnd) ? 0 : DFCS_INACTIVE);
            DrawFrameControl(dc, &amp;amp;arrowRect, DFC_MENU, drawFlags);
            ReleaseDC(hWnd, dc);

            return result;
        }
        break;

    case WM_NCDESTROY:
        RemoveWindowSubclass(hWnd, MenuButtonProc, uIdSubclass);
        break;
    }

    return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then, simply call the &lt;code&gt;SetWindowSubclass&lt;/code&gt; function on the button handle(s) and
you&amp;#8217;re good to go:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;HWND button = GetHandleFromSomewhere();
SetWindowSubclass(button, MenuButtonProc, NULL, NULL);
&lt;/code&gt;&lt;/pre&gt;
</description></item><item><title>GitHub: “No supported authentication methods”</title><link>http://poiru.net/2012/01/11/github-authentication-error</link><guid isPermaLink="false">/2012/01/11/github-authentication-error</guid><pubDate>Wed, 11 Jan 2012 20:05:00 EET</pubDate><description>&lt;p&gt;After finally joining the GitHub bandwagon yesterday, I downloaded TortoiseGit (and msysGit) for Windows as my Git client. When I tried to push commits to GitHub, I was confronted with the following error message:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;No supported authentication methods available (server sent: publickey)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I spent an hour scouring Google and troubleshooting with no avail. Right before ripping my hair out in frustration, I discovered that problem was not in msysGit or TortoiseGit, bur rather in my configuration of PuTTY. After resetting PuTTY&amp;#8217;s default settings by removing the &lt;code&gt;HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings&lt;/code&gt; key with regedit, pushing through TortoiseGit worked like a charm.&lt;/p&gt;
</description></item></channel></rss>
