Modified WinWait/WinWaitActive to return its ErrorCode.