MainFrm: Compare the window handles instead of the memory locations.

This fixes mouse hiding and seeking when the window is owned by the GraphThread.