InstallShield 로 설치 패키지를 릴리즈한 경우, 이 패키지가 실행되어 설치/삭제 작업을 수행할 때 Internet Explorer 를 모두 닫아야 할 경우가 있다. ( 예를 들면 Active X 와 같은 설치 배포본의 경우 안전한 설치/삭제를 위해 IE 를 모두 닫아준다 )

보통 설치/삭제 시에는 FindWindow 를 사용하여 실행중인 프로세스를 찾아서 SendMessage 로 종료메시지를 보내 종료하고 재 설치하지만, Internet Explorer 의 경우 여러 개의 창을 띄워놓고 사용하는 경우가 대부분인지라, 아래와 같이 구현해 준다.

BeforeMoveData 에서 OnBegin() 함수 내에서 다음과 같이 스크립트를 작성해 준다.



InstallShield 의 도움말을 살펴보면 FindWindow 의 2개의 파라미터 사용법은 아래와 같다.

FindWindow Parameters 

Parameter

Description

szClassName

Specifies the name of the class to which the window belongs. To specify “any class,” pass a null string in this parameter.

szWinName

Specifies the window caption (title). To return the handle of the topmost window in the specified class, pass a null string (“”) in this parameter.



윈도우즈의 핸들을 찾을 때는 szClassName 혹은 szWinName 2개 중 하나만 사용해도 된다. Internet Explorer 의 경우 FindWindow("ieframe", ""); 와 같이 사용하여 핸들을 찾고, 이 핸들을 갖는 여러개의 창을 닫기 위해 무작위로 1000 번의 루프를 돌면서 Windows Close 메시지를 날려준다.

AND