추가한 스크립트에 대한 간단한 설명을 드리겠습니다.
1. 인스톨시에 파일그룹에 지정된 폴더가 아닌 다른 폴더에 설치하는 루틴
2. 인스톨시 프로그램실행아이콘/언인스톨 아이콘 추가
3. 언인스톨시 실행중인 프로그램 종료하기
4. 언인스톨시 레지스트리 프로그램 환경 삭제하기
또 뭐가 있더라 암튼 소스보시고 확인해보세요...그럼
////////////////////////////////////////////////////////////////////////////////
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
// Comments: This script was generated based on the selections you made in
// the Project Wizard. Refer to the help topic entitled "Modify
// the script that the Project Wizard generates" for information
// on possible next steps.
//
////////////////////////////////////////////////////////////////////////////////
// Include header files
STRING g_szfolder;
STRING g_szTargetBefore;
STRING g_szTargetAfter;
#include "ifx.h"
////////////////////// string defines ////////////////////////////
//////////////////// installation declarations ///////////////////
// ----- DLL function prototypes -----
// your DLL function prototypes
// ---- script function prototypes -----
// your script function prototypes
// your global variables
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnFirstUIBefore
//
// EVENT: FirstUIBefore event is sent when installation is run for the first
// time on given machine. In the handler installation usually displays
// UI allowing end user to specify installation parameters. After this
// function returns, ComponentTransferData is called to perform file
// transfer.
//
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIBefore()
number nResult,nSetupType;
string szTitle, szMsg;
string szLicenseFile, szQuestion;
string szDir;
string szfolder;
begin
// TO DO: if you want to enable background, window title, and caption bar
title
// SetTitle( @TITLE_MAIN, 24, WHITE );
// SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION );
// Enable( FULLWINDOWMODE );
// Enable( BACKGROUND );
// SetColor(BACKGROUND,RGB (0, 128, 128));
TARGETDIR = PROGRAMFILES ^@PRODUCT_NAME; // 프로그램이 설치될 디렉토리
szDir = TARGETDIR;
g_szTargetBefore = TARGETDIR; // file group에서 정한 위치
SHELL_OBJECT_FOLDER = @FOLDER_NAME;
Dlg_Start:
// beginning of dialogs label
Dlg_SdWelcome:
szTitle = "";
szMsg = "";
nResult = SdWelcome( szTitle, szMsg );
if (nResult = BACK) goto Dlg_Start;
Dlg_SdLicense:
szLicenseFile = SUPPORTDIR ^ "license.txt";
szTitle = "";
szMsg = "";
szQuestion = "";
nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdAskDestPath:
szTitle = "";
szMsg = "";
nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );
TARGETDIR = szDir;
g_szTargetAfter = szDir; // 인스톨중에 설치 폴더를 지정했을 때의 위치
if (nResult = BACK) goto Dlg_SdLicense;
Dlg_ObjDialogs:
nResult = ShowObjWizardPages(nResult);
if (nResult = BACK) goto Dlg_SdAskDestPath;
Dlg_SdSelectFolder:
szfolder = SHELL_OBJECT_FOLDER;
szTitle = "";
szMsg = "";
nResult = SdSelectFolder( szTitle, szMsg, szfolder );
SHELL_OBJECT_FOLDER = szfolder;
g_szfolder = szfolder;
if (nResult = BACK) goto Dlg_ObjDialogs;
// setup default status
SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnMoving
//
// EVENT: Moving event is sent when file transfer is started as a result of
// ComponentTransferData call, before any file transfer operations
// are performed.
//
///////////////////////////////////////////////////////////////////////////////
function OnMoving()
string szAppPath;
begin
// Set LOGO Compliance Application Path
// TO DO : if your application .exe is in a subfolder of TARGETDIR then add
subfolder
szAppPath = TARGETDIR;
RegDBSetItem(REGDB_APPPATH, szAppPath);
RegDBSetItem(REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY);
end;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnMaintUIAfter
//
// EVENT: MaintUIAfter event is sent after file transfer, when end user runs
// installation that has already been installed on the machine. Usually
// this happens through Add/Remove Programs applet.
// In the handler installation usually displays UI that will inform
// end user that maintenance/uninstallation has been completed
successfully.
//
///////////////////////////////////////////////////////////////////////////////
function OnMaintUIAfter()
STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
NUMBER bOpt1, bOpt2;
STRING szKey, svResult, szCaption;
NUMBER nRootKey, nRet;
HWND hWnd;
begin
/*
if(ExistsDir (g_szTargetAfter) = EXISTS) then
SprintfBox (INFORMATION, "12345", "%s already exists.", "111");
endif;
*/
/*
hWnd = FindWindow("","MainFrame");
SendMessage(hWnd,WM_SYSCOMMAND,SC_CLOSE,0);
*/
DeleteDir(g_szTargetAfter,ALLCONTENTS); // 프로그램 삭제후 다시 한번 디렉토리
삭제
// 그냥 확인차 한번 더
// 아래의 코드는 언인스톨시 관련 레지스트리 지우는 루틴 입니다.
szKey = "software\\BESTPROGRAM";
nRootKey = HKEY_CURRENT_USER;
RegDBSetDefaultRoot(nRootKey);
RegDBDeleteKey(szKey);
Disable(STATUSEX);
ShowObjWizardPages(NEXT);
bOpt1 = FALSE;
bOpt2 = FALSE;
szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);
end;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnFirstUIAfter
//
// EVENT: FirstUIAfter event is sent after file transfer, when installation
// is run for the first time on given machine. In this event handler
// installation usually displays UI that will inform end user that
// installation has been completed successfully.
//
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIAfter()
STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
NUMBER bOpt1, bOpt2;
STRING szPath,szCmd,szProgram;
NUMBER nResult;
STRING svPath,svPath1,StartIn; //경로를 입력 변수
STRING szTargetDir;
begin
// 인스톨시에 지정된 디렉토리로 프로그램 설치 했을때의 동작
// 파일 그룹에서 설정해준 디렉토리 말고 다른 디렉토리 설정시에
SRCDIR = g_szTargetBefore;
TARGETDIR = g_szTargetAfter;
if(g_szTargetBefore = g_szTargetAfter) then
else
XCopyFile("*.*","*.*",COMP_NORMAL);
DeleteDir(g_szTargetBefore, ALLCONTENTS);
endif;
////////////////////////////////////////////////////////////
// 아래의 코드는 실행 아이콘과 언인스톨 아이콘을 등록하는 루틴
svPath = TARGETDIR ^ "client.EXE"; //TARGETDIR은 설치될 경로...
StartIn = TARGETDIR; //시작위치
LongPathToQuote(svPath,TRUE);
AddFolderIcon(g_szfolder,"프로그램",svPath,StartIn,"",0,"",REPLACE);
szPath=DISK1TARGET ^"setup.exe";
LongPathToQuote(szPath,TRUE);
szCmd="UNINSTALL"; // 이렇게 해주면 제어판에서 언인스톨 하는것과 같이 동작
LongPathToShortPath (szCmd);
if (!MAINTENANCE) then
szProgram =szPath + " " + szCmd;
LongPathToQuote(szProgram, TRUE);
AddFolderIcon(g_szfolder,"프로그램제
거",szProgram,/*DISK1TARGET,WINDIR^"IsUninst.exe"*/"","", 0, "", REPLACE);
endif;
Disable(STATUSEX);
ShowObjWizardPages(NEXT);
bOpt1 = FALSE;
bOpt2 = FALSE;
szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);
SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);
end;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnMaintUIBefore
//
// EVENT: MaintUIBefore event is sent when end user runs installation that
// has already been installed on the machine. Usually this happens
// through Add/Remove Programs applet. In the handler installation
// usually displays UI allowing end user to modify existing installation
// or uninstall application. After this function returns,
// ComponentTransferData is called to perform file transfer.
//
///////////////////////////////////////////////////////////////////////////////
function OnMaintUIBefore()
NUMBER nResult, nType;
STRING szTitle, szMsg, svDir, svResult, szCaption;
NUMBER nRet;
HWND hWndMain, hWndLogon, hWndOption, hWndVideoDefault, hWndVideoType;
HWND hWndCapture;
NUMBER nCloseResult;
begin
// TO DO: if you want to enable background, window title, and caption bar
title
// SetTitle( @TITLE_MAIN, 24, WHITE );
// SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION );
// SetColor(BACKGROUND,RGB (0, 128, 128));
// Enable( FULLWINDOWMODE );
// Enable( BACKGROUND );
// 아래의 루틴은 언인스톨시 프로그램이 실행되어 있으면 먼저 종료하는 루틴
while(1)
hWndMain = FindWindow("","MainFrame");
if(hWndMain = NULL) then
goto Dlg_Start:
else
hWndLogon = FindWindow("","로그인");
hWndOption = FindWindow("","로그인1");
hWndVideoDefault = FindWindow("","로그인2");
hWndVideoType = FindWindow("","로그인3");
hWndCapture = FindWindow("","로그인4");
if(hWndLogon = NULL) then
else
SendMessage(hWndLogon,WM_SYSCOMMAND,SC_CLOSE,0);
endif;
if(hWndOption = NULL) then
else
SendMessage(hWndOption,WM_SYSCOMMAND,SC_CLOSE,0);
endif;
if(hWndVideoDefault = NULL) then
else
Delay(1);
SendMessage
(hWndVideoDefault,WM_SYSCOMMAND,SC_CLOSE,0);
endif;
if(hWndVideoType = NULL) then
else
Delay(1);
SendMessage(hWndVideoType,WM_SYSCOMMAND,SC_CLOSE,0);
endif;
if(hWndCapture = NULL) then
else
SendMessage(hWndCapture,WM_SYSCOMMAND,SC_CLOSE,0);
endif;
SendMessage(hWndMain,WM_SYSCOMMAND,SC_CLOSE,0);
endif;
endwhile;
Dlg_Start:
Disable(BACKBUTTON);
// nType = SdWelcomeMaint(szTitle, szMsg, MODIFY); <- 이것은 언인스톨시
nType = REMOVEALL; // 설정 다이이얼로그 나오지 않게
Enable(BACKBUTTON);
if (nType = REMOVEALL) then
svResult = SdLoadString(IFX_MAINTUI_MSG);
szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
nResult = SprintfBox(MB_OKCANCEL,szCaption,"%s",svResult);
if (nResult = IDCANCEL) then
exit;
endif;
endif;
nResult = NEXT;
Dlg_SdComponentTree:
if (nType = MODIFY) then
szTitle = "";
szMsg = "";
nResult = SdComponentTree(szTitle, szMsg, TARGETDIR, "", 2);
if (nResult = BACK) goto Dlg_Start;
endif;
Dlg_ObjDialogs:
nResult = ShowObjWizardPages(nResult);
if ((nResult = BACK) && (nType != MODIFY)) goto Dlg_Start;
if ((nResult = BACK) && (nType = MODIFY)) goto Dlg_SdComponentTree;
switch(nType)
case REMOVEALL: ComponentRemoveAll();
case REPAIR: ComponentReinstall();
endswitch;
// setup default status
SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);
end;
데브피아 최범규님의 펌글입니다.
http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=33&MAEULNO=13&no=50&page=4








