Hm.. you don't need to capture mouse to get cursor position. Am curious how you got it to not working. For e.g. this simple app does it all without having focus or anything

Code:
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

 	POINT pt;
	
	while(1)
	{
		GetCursorPos(&pt);
		std::wstringstream streamss;
		streamss << pt.x << "\t" << pt.y;
		OutputDebugStringW(streamss.str().c_str());
		Sleep(100);
	}
	return 0;

}