Saturday, November 25, 2006

KeyFix4000: Improve your MS Natural Keyboard 4000

I'm loving the MS Natural Keyboard 4000, but it does have some issues.

First, it is conspicuously missing a Windows key on the right side. Second, there is no way to remap the back and forward buttons to act as mouse buttons. After googling in futility for a solution, I decided to whip one up myself. (After all, this was nothing a little keyboard hooking couldn't solve.)

The result? KeyFix4000.

The mouse button mapping is pretty straight-forward - it just translates a click on the back/forward button to a click on the left/right mouse button.

The Windows key issue was a little tricky - how do you fix a key that doesn't exist? Well, the Apps key is pretty much where the Windows key should be, and I realized I could overload it. Now, when pressed by itself, it functions as the Apps key, and when pressed in combination with another key, it works as the Windows key. This dual usage works surprisingly well.

Download executable
C++ source code at GitHub

Sunday, November 12, 2006

Fun compiler bugs

void bar() {}

namespace foo
{
using ::bar;
}

using namespace foo;
// namespace {}

int main(int argc, char * argv[])
{
bar();
return 0;
}

In VC6, the preceding block of code produces
error C2668: 'bar' : ambiguous call to overloaded function
and the error goes away when you uncomment "namespace {}". Yikes.