You're accessing an empty pointer here, which consequently causes a crash. Probably you meant to do this:

Code:
function getscreenres()
{
	SCRMODE resolution;	
	rvalue = EnumDisplaySettings(NULL, 1, &resolution); // mind the '&'
	xvalue = resolution.dmPelsWidth;
}