Your code with the values of the resolution my monitor works.
My code did not work because I noted the resolution monitor with "fx.PrimaryScreen.MaxX" and "fx.PrimaryScreen.MaxY", but the value MaxY is always a little smaller than the real one.
My monitor is 1280x800, but I function detects 1280x768. Why ???
Thank you
Marco