In case anyone is interested, restoring the size didn't work. I managed to get it back in original state by sending a WM_SYSCOMMAND message with SC_RESTORE as wParam.