find the specified window and do needed operations