Windows GetLastError Message

“Error 126 happened when doing foo”? How about “Error 126 (The specified module could not be be found) when doing foo”? That’s what this next code sample demonstrates.

C++ Utility Code Series

I’ve been going through some old “utility code” that I wrote in the past, and realized I spent a lot of time trawling through MSDN documentation and random blog posts to assemble these utility functions. Most of these functions never existed in full in any one spot so I figured I should document these solutions…… Continue reading C++ Utility Code Series

How to expose C# async methods in WinRT components

When authoring Windows Runtime (WinRT) components with C# you cannot use the standard C# async Task pattern. Say for example you have code like: public sealed class MyComponent { public async Task<string> SaveToFile(StorageFolder folder, string fileName) { var file = await folder.CreateFileAsync(fileName); var output = MakeRandomString(128); await FileIO.WriteTextAsync(file, output); return output; } } Visual Studio…… Continue reading How to expose C# async methods in WinRT components

Redirecting standard output to console in Windows

When I first started making Windows programs in the early 2000s I needed a way to display logging information visually to the user. With some internet sleuthing I discovered how to create a windows console and using black magic, how to redirect the standard input/output streams to print to this window. With that problem solved…… Continue reading Redirecting standard output to console in Windows

Hello World Redux

Well, it’s been awhile. I took a long hiatus from the online world over the last nine months or so. In that time, I took a big interest in online services (aka the CLOUD), married the most wonderful women in the world, left the game development world and joined the borg Microsoft, moved three thousand…… Continue reading Hello World Redux

Published
Categorized as Personal

Getting rid of C#’s obj folders

A small tip for developers who are irritated with Visual Studio doing this to your pristine source tree: To get the obj directories out of your source tree, and somewhere nicer (your project’s build output directory for example) open up your project’s .csproj file in an external editor. Locate any line that has the <OutputPath>…… Continue reading Getting rid of C#’s obj folders

Printing Generic C++ Containers

Always wanted a simple utility function to print our an arbitrary STL container? Well, so long as your container type support directional iterators… this method I wrote will work perfectly! Its a great example for why templates are awesome #include <sstream> template<typename T> std::string dumpContainer( const T& container, std::string sep ) { typename T::const_iterator itr;…… Continue reading Printing Generic C++ Containers