One of the free perks of working for Microsoft - when you want to know why a feature in a Microsoft product was done a particular way, you can always chase down the right people. Not that this is not possible outside Microsoft but it sure is a lot easier inside. In fact, a lot of times you see threads internally of the form "Why was foo in Windows done in that way?" and there'll instantly be a couple of response from the developer on the feature enumerating all the reasons why.

Regional and Language Settings

Ever wondered what this part of the 'Regional and Language Options' part of the Control Panel applet did? I sure did! For a long time, it wasn't obvious to me what that combo box actually did. I didn't recall seeing any app giving me any extra services. And almost no app actually recognizes which country I'm in. I was also curious as to how I can get at that information through a documented API instead of poking through the registry.

A couple of emails and a few of Michael Kaplan's blog posts later, I was set straight - that combo box sets the GeoId for your system. Here's a small snippet of code which prints out what your current GeoId is

#include <stdio.h>
#include <windows.h>


int wmain(int argc, wchar_t* argv[])
{
	GEOID currentGeoId = GetUserGeoID(GEOCLASS_NATION);

	if(GEOID_NOT_AVAILABLE != currentGeoId)
	{
		wchar_t wszBuffer[100];

		if(0!= GetGeoInfo(currentGeoId, GEO_FRIENDLYNAME, wszBuffer,
			sizeof(wszBuffer)/sizeof(wchar_t), 0))
		{
			
			wprintf(wszBuffer);			
		}
	}

	return 0;
}

Michael Kaplan has blogged about this extensively here, here and here.