i dont find any problem with this. it should be running fine. the variables "theDesktopWidth" and "theDesktopHeight" are declared global ?
Without it being declared as global, it'd return 0.
I've tested your code and have it working on mine, are you sure that your pc isn't set up for 2 monitors, and it's reading the values of monitor 1 though it doesn't exist?
It's the only think I can think of
