center window in current monitor
Posted on 2005-05-05
We are attempting to add minimal multi monitor support to our application. We have some windows that either are centered in our application, centered in the monitor, or take up the whole monitor. I can get the position of our window in the secondary(or more) monitor, but I am not sure how to determine what offset to use for centering our window in the monitor. I can fudge it by using GetWindowRect(GetDesktopWindow(),&rectDesktop); but that doesnt take into account different resolutions on different monitors. Ideally there should be a way to get the the x,y of top left and bottom right of the monitor a window is in. Our application needs to run on Win95,NT, and above although the multi monitor support does not need to function in 95/NT so I cannot imlicitly link with User32.lib and use GetMonitorInfor(), etc.