MainFrm: Improve window comparison when hiding the mouse and toolbar.

Compare the window handles instead of the memory locations.
This fixes mouse hiding when the window is owned by a different thread.