Now, whether that Width/Height is only calculated once at program start-up, or on the fly as needed, I honestly don’t know.
If your program requires detections for this type of thing, you may need to resort to using declare library with the windows api (or Linux/Mac equivalent).
Fooling around a little with Win API... I hope the wife doesn't find out. So, coincidence or does this code actually work...