This is due to the way MDI windows work. If you maximize an MDI window and then make another MDI window active, Windows unmaximizes the non-active window. mIRC is returning the state and size of the non-active MDI window as provided by Windows. One way to get around this is to check if the active MDI window is zoomed. If it is, use its size instead, since that will be the size of any MDI window that is made active.