Zoom and focus are required when photoelectric tracking system is used to track moving targets. The deviation of focusing window caused by the change of target posture and position is the main reason that leads to the failure of automatical focusing. In light of this, a method to establish dynamic focusing window for target is proposed. We used gradient energy evaluation function to extract target features and then estab-lish focusing window by correlation treatment method and boundary expansion, which can overcome the de-fects of original method. The experiment results show that the new method can establish effective focusing window for 704×576 pixels images during 20ms. The results demonstrate that this method can meet the need of real-time operation.