■ 출처 : 본인

 

■ Script project를 기준으로 한 기본 흐름 설명.

 

Installation Designer를 선택하면 왼쪽에 Tree구조의 메뉴가 있다.

Behavior and Logic의 InstallScript를 선택하면 project에서 사용되는 script를 볼 수 있다.

 

초기에 project 구성 시 Project Assistant의 Installation Interview를 수행했다면

기본적으로 OnFirstUIBefore라는 함수가 정의되어 있을 것이다.

 

OnFirstUIBefore는 처음으로 install이 진행될때, 실제 file 설치 과정 전 과정들을 처리하는 부분이다.

Welcome dlg, License 동의 얻기, 경로 설정 등의 작업들이 이루어지는 곳이라고 보면 된다.

 

OnFirstUIBefore만 가지고는 Install의 전과정을 제어할수 없기 때문에 모든 UI Sequence 흐름 파악을 위해

OnShowUI를 정의하자.

 
 

 

script page 좌측 상단 왼쪽 combo에서 Advance를 선택하고, 오른쪽 combo에서 OnShowUI를 찾아 선택하면

script page에 자동으로 OnShowUI가 추가된다.

 

자동으로 추가된 OnShowUI 내용. 친절하게 함수 상단에 설명도 달려있다.

--------------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------
// OnShowUI
//
// This function drives the UI sequence and file transfer of the setup.
// 
// The OnShowUI event is called directly by the framework to initiate
// the UI sequence and file transfer of the setup. By default this event
// displays UI that informs the end user that the maintenance setup has been
// completed successfully.
// 
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnShowUI()
BOOL bMaintenanceMode, bUpdateMode;
string szIgnore, szTitle;
begin
  
  // Enable dialog caching
  Enable( DIALOGCACHE );
  
  // Determine what events to show.
  bUpdateMode = FALSE;
  bMaintenanceMode = FALSE;
 
  // Remove this to disabled update mode.
  if( UPDATEMODE ) then
   bUpdateMode = TRUE;
  endif;

  // Remove this to disable maintenance mode.
  if ( MAINTENANCE ) then
   bMaintenanceMode = TRUE;
  endif;

  // Show appropriate UI

  // TODO: Enable if you want to enable background etc.
  //if ( LoadStringFromStringTable( "TITLE_MAIN", szTitle ) < ISERR_SUCCESS ) then // Load the title string.
  // szTitle = IFX_SETUP_TITLE;
  //endif;
  //SetTitle( szTitle, 24, WHITE );
  //Enable( FULLWINDOWMODE );         
  //Enable( BACKGROUND );
  //SetColor( BACKGROUND, RGB( 0, 128, 128 ) );

  if( bUpdateMode ) then
   OnUpdateUIBefore();
  else
   if ( bMaintenanceMode ) then
    OnMaintUIBefore();
   else
    OnFirstUIBefore();
   endif;
  endif;

  // Move Data
  OnMoveData();
  
  if( bUpdateMode ) then
   OnUpdateUIAfter();
  else
   if ( bMaintenanceMode ) then
    OnMaintUIAfter();
   else
    OnFirstUIAfter();
   endif;
  endif;

  // Disable dialog caching
  Disable(DIALOGCACHE);

end;

--------------------------------------------------------------------------------------------------------

 

OnShowUI는 (설명대로) Setup의  UI sequence와 file 전송을 결정한다.

C언어로 예을 들자면 main 함수 이다.

 

위 내용 중 기타내용은 다 추려내고 골격만 보면 다음과 같다.

--------------------------------------------------------------------------------------------------------

if( bUpdateMode ) then
       OnUpdateUIBefore();
else
       if ( bMaintenanceMode ) then
             OnMaintUIBefore();
      else
             OnFirstUIBefore();
      endif;
endif;

 

// Move Data
OnMoveData();
  
if( bUpdateMode ) then
     OnUpdateUIAfter();
else
     if ( bMaintenanceMode ) then
           OnMaintUIAfter();
     else
           OnFirstUIAfter();
     endif;

endif

--------------------------------------------------------------------------------------------------------

bUpdateMode, bMaintenanceMode 는 어떤식의 Setup 인지(Modify, Repair, Uninstall 등)를 나타내는 변수다.

OnShowUI 시작부분을 보면 UPDATEMODE, MAINTENANCE 라는 시스템 변수로 부터 얻은 값을 얻어오는 부분을 볼수있다.

UPDATEMODE는 업데이트 모드(== Repair 모드)이고, MAINTENANCE 는 Uninstall 모드라고 생각하면 되겠다.

SETUP본의 설치가 되어있지 않은 상태에서 SETUP을 실행 할 경우, 당연히 update 모드도 아니고 uninstall도 아니다.

 

함수 이름들은 InstallShield가 정의 한 것들이고, 파일 설치/삭제를 기준으로 전(Before)과 후(After)로 나뉘어져있는 것을 알수 있을 것이다.

 

파일의 설치/삭제는 OnMoveData 에서 수행.

 

사용자가 SETUP을 실행하여 선택할 수 있는 모드는 총 3가지( Install, Repair, Uninstall)이고

각각의 모드에 따른 실행 흐름은 다음과 같다.

● 설치가 된적이 없거나 Uninstall되어 있는 상태에서 실행 할 때 flow

OnFirstUIBefore  ==>  OnMoveData  ==>  OnFirstUIAfter

 

● 설치가 되어 있는 상태에서 Update(==Repair) 시 flow

OnUpdateUIBefore  ==> OnMoveData  ==> OnUpdateUIAfter

 

● Uninstall 시 flow

OnMaintUIBefore ==> OnMoveData  ==> OnMaintUIAfter

 

 

                                                         Script project의 기본 흐름 설명 끝.

'프로그래밍' 카테고리의 다른 글

Visual Assist X 사용 중에 expried 됐을 때 해결방법  (0) 2016.02.18
Google coding style guide  (0) 2013.02.05
wow64 관련  (0) 2011.08.26
Introduction to MSMQ  (0) 2011.08.26
실행 중 Window class name 바꾸기  (0) 2011.08.24
Posted by 아..몰라 ㅡ.ㅡ+
,