installshield使用:使用InstallShield制作ASP安装程序(3)



///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: _disibledevent=>bOpt2 = FALSE;
szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
szMsg2 = \"\";
szOption1 = \"\";
szOption2 = \"\";
szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
SdFinishEx(szTitle,szMsg1,szMsg2,szOption1,szOption2,bOpt1,bOpt2);
0;
end;

///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: _disibledevent=>RegDBSetItem(REGDB_APPPATH, szAppPath);
RegDBSetItem(REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY);

end;

// --- script file section ---


function LoginSQL( szTitle,szSqlsvname,szSqluser,szSqlpassword )

STRING szDlg, szTemp;
NUMBER bDone, nId, nMessage, nTemp;
INT hwndDlg;
HWND hwndControl;
begin
szDlg = \"DLG_LoginSQLSV\";

// record data produced by this dialog
(MODE=SILENTMODE) then
SdMakeName( szAppKey, szDlg, szTitle, nLoginSQL );
SilentReadData( szAppKey, \"Result\", DATA_NUMBER, szTemp, nId );
((nId != BACK) && (nId != CANCEL)) then
SilentReadData( szAppKey, \"szSqlsvname\", DATA_STRING, szSqlsvname, nTemp );
SilentReadData( szAppKey, \"szSqluser\", DATA_STRING, szSqluser, nTemp );
SilentReadData( szAppKey, \"szSqlpassword\", DATA_STRING, szSqlpassword, nTemp );
end;

nId;
end;

// ensure general initialization is complete
(!bSdInit) then
SdInit;
end;

(EzDefineDialog( szDlg, \"\", \"\",DLG_LoginSQLSV ) = DLG_ERR) then
-1;
end;

// 在用户选择标准按钮前进行循环
bDone = FALSE;

while (!bDone)

nId = WaitOnDialog( szDlg );//显示对话框
hwndControl = GetDlgItem (hwndDlg, SD_EDIT_SQLSV_NAME);
SetFocus (hwndControl);

switch(nId)
DLG_INIT:
CtrlSetText( szDlg, SD_EDIT_SQLSV_NAME, szSqlsvname );
CtrlSetText( szDlg, SD_EDIT_SQLSV_USER, szSqluser );
CtrlSetText( szDlg, SD_EDIT_SQLSV_PASSWORD, szSqlpassword );

hwndDlg = CmdGetHwndDlg( szDlg );
SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );

//This function s the caption for old style dialogs or
//s the text in the top banner area of win2k style dialogs
SdSetDlgTitle(szDlg, hwndDlg, szTitle);
SD_EDIT_SQLSV_NAME:
nMessage = CtrlGetSubCommand( szDlg );
( nMessage = EDITBOX_CHANGE ) then
CtrlGetText( szDlg, SD_EDIT_SQLSV_NAME, szSqlsvname );
end;
SD_EDIT_SQLSV_USER:
nMessage = CtrlGetSubCommand( szDlg );
( nMessage = EDITBOX_CHANGE ) then
CtrlGetText( szDlg, SD_EDIT_SQLSV_USER, szSqluser );
end;
SD_EDIT_SQLSV_PASSWORD:
nMessage = CtrlGetSubCommand( szDlg );
( nMessage = EDITBOX_CHANGE ) then
CtrlGetText( szDlg, SD_EDIT_SQLSV_PASSWORD, szSqlpassword );
end;
OK:
nId = NEXT;
bDone = TRUE;

BACK:
nId = BACK;
bDone = TRUE;

DLG_ERR:
SdError( -1, \"SdWelcome\" );
nId = -1;
bDone = TRUE;

DLG_CLOSE:
SdCloseDlg( hwndDlg, nId, bDone );

default:
// check standard handling
(SdIsStdButton( nId ) && SdDoStdButton( nId )) then
bDone = TRUE;
end;
endswitch;

endwhile;

EndDialog( szDlg );
ReleaseDialog( szDlg );

SdUnInit( );

// record data produced by this dialog
SdMakeName( szAppKey, szDlg, szTitle, nLoginSQL );
SilentWriteData( szAppKey, \"szSqlsvname\", DATA_STRING, szSqlsvname, 0 );
SilentWriteData( szAppKey, \"szSqluser\", DATA_STRING, szSqluser, 0 );
SilentWriteData( szAppKey, \"szSqlpassword\", DATA_STRING, szSqlpassword, 0 );
SilentWriteData( szAppKey, \"Result\", DATA_NUMBER, \"\", nId );

nId;

end;

function exeSQLfile( szsqlfilename )
STRING szCmdLine;
NUMBER nTemp;
begin
szCmdLine = SUPPORTDIR ^\"osql.exe\";
(LaunchAppAndWait(SUPPORTDIR ^\"osql.exe\", szsqlfilename,WAIT) < 0) then
MessageBox (\"不能运行SQL安装文件.\",SEVERE);


end;

end;

function moddbdir
STRING szfile;
NUMBER nvResult,nvLineNumber;
STRING szwindir,svReturnLine;
NUMBER sn,nStartPos;
STRING sz1,sz2,szdir;
NUMBER nTemp;
begin
szfile = TARGETDIR ^\"\\createdb.sql\";
//替换 DB文件建立路径
while (nvResult != END_OF_FILE)
nvResult = FileGrep (szfile, \"D:\\cycdata\\\", svReturnLine,nvLineNumber, RESTART);
//FileDeleteLine(szodbcregfile, nvLineNumber, nvLineNumber);
sn=StrLength (svReturnLine);
nStartPos = StrFind(svReturnLine,\"D:\\cycdata\\\");
StrSub (sz1, svReturnLine, 0, nStartPos);
StrSub (sz2, svReturnLine, nStartPos+11, sn-nStartPos-11);
szdir=sz1+TARGETDIR ^sz2;
FileInsertLine(szfile, szdir,nvLineNumber, REPLACE);
sz1=\"\";
sz2=\"\";
szdir=\"\";
endwhile;

end;

//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: _disibledevent=>


//
//Description:InstallShield script
//
// Comments:This template script performs a basic up. With minor
// modications, this template can be adapted to create
// , customized ups.
//
////////////////////////////////////////////////////////////////////////////////


// Include header files

# \"x.h\" //DO NOT REMOVE

////////////////////// s ////////////////////////////

//////////////////// ation 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 ation is run for the first
// time _disibledevent=>


// Enable( FULLWINDOWMODE );
// Enable( BACKGROUND );
// SetColor(BACKGROUND,RGB (0, 128, 128));

//默认值设定
TARGETDIR = \"C:\\Inetpub\\wwwroot\\WebApp\";
szDir = TARGETDIR;
SHELL_OBJECT_FOLDER = @FOLDER_NAME;
svName = \"Daniel\";
svCompany = \"N/A\";
svSerial = \"111-1111111\";

Dlg_Start:
// beginning of dialogs label

Dlg_SdWelcome:
szTitle = \"\";
szMsg= \"\";
nResult = SdWelcome( szTitle, szMsg );
(nResult = BACK) goto Dlg_Start;

Dlg_SdLicense:
szLicenseFile = SUPPORTDIR ^ \"license.txt\";
szTitle = \"\";
szMsg = \"\";
szQuestion = \"\";
nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
(nResult = BACK) goto Dlg_SdWelcome;

Dlg_SdRegisterUserEx:
szMsg= \"\";
szTitle = \"\";
nResult = SdRegisterUserEx( szTitle, szMsg, svName, svCompany, svSerial );
//验证序列号
(svSerial !=\"111-1111111\") then
MessageBox (\"InValid Serial!\",WARNING);
goto Dlg_SdRegisterUserEx;
end;
(nResult = BACK) goto Dlg_SdLicense;

Dlg_SdAskDestPath:
szTitle = \"\";
szMsg= \"\";
nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );
TARGETDIR = szDir;
(nResult = BACK) goto Dlg_SdRegisterUserEx;

Dlg_SdComponentTree:
((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath;
szTitle = \"\";
szMsg = \"\";
szTargetdir = TARGETDIR;
szComponents = \"\";
nLevel = 2;
(nSetupType = CUSTOM) then
nResult = SdComponentTree(szTitle, szMsg, szTargetdir, szComponents, nLevel);
(nResult = BACK) goto Dlg_SdAskDestPath;
end;

Dlg_SdSelectFolder:
szfolder = SHELL_OBJECT_FOLDER;
szTitle = \"\";
szMsg = \"\";
nResult = SdSelectFolder( szTitle, szMsg, szfolder );
SHELL_OBJECT_FOLDER = szfolder;
(nResult = BACK) goto Dlg_SdComponentTree;


// up default status
SetStatusWindow(0, \"\");
Enable(STATUSEX);
StatusUpdate(ON, 100);

0;

end;

Tags:  installshield教程 installshield12 installshield installshield使用

延伸阅读

最新评论

发表评论