狠狠色丁香婷婷综合尤物/久久精品综合一区二区三区/中国有色金属学报/国产日韩欧美在线观看 - 国产一区二区三区四区五区tv

LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發文檔 其他文檔  
 
網站管理員

使用Installshield制作asp,asp.net應用的安裝程序

admin
2010年8月19日 23:57 本文熱度 3869

在使用asp,asp.net編寫Web應用時,最大的煩惱莫過于程序的分發的部署,由于面向的最終用戶,所以程序的安裝的過程必須要簡單,方便和快捷。


下面提供了Installshield的腳本,改腳本功能包括:


1,檢測IIS是否安裝


2,檢測IE版本


3,自動建立SQL數據庫


4,自動建立IIS虛擬目錄


5,能讀取注冊表和INI文件


6,注冊.dll組件


  應用程序開發環境:Windows2000+VS 2003+SQL2000


  制作安裝程序環境:Installshield7.0(其實6.22以上都可以,只是中文語言包太難找,所以就用7.0了,另7.0界面也好看多了,XP風格)


////////////////////////////////////////////////////////////////////////////////


//


// 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


#include "ifx.h"


////////////////////// string defines ////////////////////////////


number xx1,xx2;


//////////////////// installation declarations ///////////////////


// ----- DLL function prototypes -----


// your DLL function prototypes


// ---- script function prototypes -----


// your script function prototypes


prototype CreateDataBase(STRING,STRING,STRING);//附加數據庫


prototype CheckIIS(); //檢測是否安裝了iis


prototype Checkie(); //檢測ie版本


prototype Checkmdac(); //檢測mdac版本


prototype regcom(); //注冊jamil組件


// prototype deliis(STRING);//刪除虛擬目錄


prototype Writeini(STRING,STRING,STRING);


prototype DelDataBase(STRING,STRING,STRING);


// 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, FeatureTransferData is called to perform file


// transfer.


//


///////////////////////////////////////////////////////////////////////////////


function OnFirstUIBefore()


// number nResult,nSetupType;


// string szTitle, szMsg;


// string szLicenseFile, szQuestion;


// string szName, szCompany;


// string szTargetPath;


// string szDir;


// string szFeatures, szTargetdir;


// number nLevel;


// LIST listStartCopy;


//number nvSize;


//number nUser;


number nResult,nSetupType;


string szTitle, szMsg;


string szLicenseFile, szQuestion;


string szName, szCompany, szSerial;


string szFeatures, szTargetdir;


number nLevel;


LIST listStartCopy,list;


number nvSize;


number nUser;


number nOpt,svEdit1,svEdit2;


STRING szServerIP,szServerPort,szServerIPDefault,szServerPortDefault;


STRING szSQLsvr,szSQLusr,szSQLpwd,svSQLsvr,svSQLusr,svSQLpwd;


STRING svName, svCompany, svSerial;


STRING szFile,szTargetPath,szDir,szfolder;


STRING szField1,szField2;


STRING szDefault,svResult;


string szComponents;


OBJECT piisObj;


STRING szTitle1;


STRING szMsg1,szMsg2;


STRING szMsg11, szMsg12, szOpt1, szOpt2;


BOOL bvOpt1, bvOpt2;


begin


// TO DO: if you want to enable background, window title, and caption bar title


//SetTitle( @PRODUCT_NAME, 24, WHITE );


// SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );


// Enable( FULLWINDOWMODE );


// Enable( BACKGROUND );


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


//SetFont (FONT_TITLE, STYLE_NORMAL, "宋體");


SHELL_OBJECT_FOLDER = @PRODUCT_NAME;


nSetupType = TYPICAL;


szDir = INSTALLDIR;


szName = "";


szCompany = "";


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_SdCustomerInformation:


szMsg = "";


szTitle = "";


nResult = SdCustomerInformation( szTitle, szName, szCompany, nUser );


if (nResult = BACK) goto Dlg_SdLicense;


Dlg_SdAskDestPath:


szTitle = "";


szMsg = "";


nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );


INSTALLDIR = szDir;


if (nResult = BACK) goto Dlg_SdCustomerInformation;


Dlg_SelMode ://設置數據庫服務器 對話框


szTitle = "是否安裝.net框架";


szMsg = "是否要安裝.net框架,如果已經安裝了.net框架則不需要安裝。";


szField1="我要安裝.net框架。";


szField2="我已經安裝了,不需要再安裝。";


svEdit1=TRUE;


svEdit2=FALSE;


SetDialogTitle(DLG_ASK_TEXT,szTitle);


//DialogSetInfo ( DLG_INFO_CHECKSELECTION, "", 1);


nOpt = EXCLUSIVE ;


nResult = AskOptions (nOpt,szMsg,szField1,svEdit1,szField2,svEdit2);


if (nResult = BACK) goto Dlg_SdAskDestPath;


if (svEdit1=TRUE)then


if Checkmdac() then//如果已經安裝則跳過


if(LaunchAppAndWait (SUPPORTDIR^"mdac_typ.exe","",WAIT)<0) then


MessageBox ("安裝微軟數據訪問組件是發生以外,請重新安裝。",SEVERE);


goto Dlg_SelMode;


endif;


endif;


if(LaunchAppAndWait ( SUPPORTDIR ^"dotnetfx.exe " , "" ,WAIT)<0) then


MessageBox ("安裝.net框架時發生意外,請重新安裝。",SEVERE);


goto Dlg_SelMode;


endif;


endif;


Dlg_SetupType:


szTitle = "";


szMsg = "";


nResult = SetupType ( szTitle , szMsg , "" , nSetupType , 0 );


if (nResult = BACK) then


goto Dlg_SdAskDestPath;


else


nSetupType = nResult;


if (nSetupType != CUSTOM) then


szTargetPath = INSTALLDIR;


nvSize = 0;


FeatureCompareSizeRequired(MEDIA,szTargetPath,nvSize);


if (nvSize != 0) then


MessageBox( szSdStr_NotEnoughSpace, WARNING );


goto Dlg_SetupType;


endif;


endif;


endif;


Dlg_SdFeatureTree:


if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType;


szTitle = "";


szMsg = "";


szTargetdir = INSTALLDIR;


szFeatures = "";


nLevel = 2;


if (nSetupType = CUSTOM) then


nResult = SdFeatureTree(szTitle, szMsg, szTargetdir, szFeatures, nLevel);


if (nResult = BACK) goto Dlg_SetupType;


endif;


Dlg_AskText ://設置數據庫服務器 對話框


szTitle = "設置IIS信息服務及數據庫服務器";


szMsg = "現在開始設置IIS系統";


szQuestion=" 請輸入本服務器的主機名或IP地址,安裝程序將按照您提供的資料設置IIS信息服務。如果您沒有填寫,安裝程序將自動跳過站點的創建!";


szServerIP="地址:";


szServerPort="端口:";


szServerIPDefault="192.168.0.1";


szServerPortDefault="80";


SetDialogTitle(DLG_ASK_TEXT,szTitle);


nResult=SdShowDlgEdit2 (szTitle, szQuestion,szServerIP,szServerPort,szServerIPDefault,szServerPortDefault);


if (nResult = BACK) goto Dlg_SetupType;


Dlg_AskSQL ://設置數據庫服務器 對話框


szTitle = "設置數據庫";


szMsg = "現在開始設置數據庫系統";


szQuestion=" 請輸入數據庫服務器的用戶名和密碼,安裝程序將按照您上步提供的IP地址和下面的用戶名和密碼創建和優化數據庫系統。如果您提供的用戶名和密碼是錯誤的,安裝程序將自動跳過數據的設置!";


//szSQLsvr="主機名:";


szSQLusr="用戶名:";


szSQLpwd="密碼:";


//svSQLsvr="localhost";


svSQLusr="sa";


svSQLpwd="";


SetDialogTitle(DLG_ASK_TEXT,szTitle);


nResult=SdShowDlgEdit2 (szTitle, szQuestion,szSQLusr,szSQLpwd,svSQLusr,svSQLpwd);


if (nResult = BACK) goto Dlg_AskText;


Dlg_SdStartCopy:


szTitle = "";


szMsg = "";


szTitle1 = "安裝失敗";


szMsg11 = "由于安裝時發生意外導致安裝失敗";


szMsg12 = "點擊完成退出安裝。";


szOpt1 = "";


szOpt2 ="";


listStartCopy = ListCreate( STRINGLIST );


ListAddString(listStartCopy,"用戶名:"+szName,AFTER);


ListAddString(listStartCopy,"公司名稱:"+szCompany,AFTER);


ListAddString(listStartCopy,"目標目錄:"+szDir,AFTER);


if (svEdit1=TRUE) then


ListAddString(listStartCopy,"IP地址:"+szServerIPDefault,AFTER);


ListAddString(listStartCopy,"端口號:"+szServerPortDefault,AFTER);


endif;


ListAddString(listStartCopy,"請確認您填寫的信息,按下一步開始復制文件",AFTER);


// listStartCopy = ListCreate( STRINGLIST );


//The following is an example of how to add a string(szName) to a list(listStartCopy).


//eg. ListAddString(listStartCopy,szName,AFTER);


nResult = SdStartCopy( szTitle, szMsg, listStartCopy );


ListDestroy(listStartCopy);


if (nResult = BACK) goto Dlg_SdFeatureTree;


Enable(STATUSEX);


if CheckIIS() then


if(xx1=2) goto Dlg_AskText; //判斷站點是否建立成功


// regcom();//注冊組件


CreateDataBase(szServerIPDefault,svSQLusr,svSQLpwd); // 創建和 優化數據庫


Writeini(szServerIPDefault,svSQLusr,svSQLpwd);//寫ini文件


else


MessageBox ("你的計算機沒有安裝IIS!請安裝后重試!",SEVERE);


endif;


return 0;


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,


// FeatureTransferData is called to perform file transfer.


//


///////////////////////////////////////////////////////////////////////////////


function OnMaintUIBefore()


NUMBER nResult, nType;


STRING szTitle, szMsg, svDir, svResult, szCaption;


STRING svip,svuser,svpass;


begin


// TO DO: if you want to enable background, window title, and caption bar title


// SetTitle( @PRODUCT_NAME, 24, WHITE );


// SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );


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


// Enable( FULLWINDOWMODE );


// Enable( BACKGROUND );


Dlg_Start:


Disable(BACKBUTTON);


nType = SdWelcomeMaint(szTitle, szMsg, MODIFY);


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) goto Dlg_Start;


endif;


nResult = NEXT;


Dlg_SdFeatureTree:


if (nType = MODIFY) then


szTitle = "";


szMsg = "";


nResult = SdFeatureTree(szTitle, szMsg, INSTALLDIR, "", 2);


if (nResult = BACK) goto Dlg_Start;


endif;


switch(nType)


case REMOVEALL: FeatureRemoveAll();


case REPAIR: FeatureReinstall();


endswitch;


GetProfString (SystemFolder^"dbconn.ini", "dbconnection","ip", svip);


GetProfString (SystemFolder^"dbconn.ini", "dbconnection","db_user", svuser);


GetProfString (SystemFolder^"dbconn.ini", "dbconnection","db_pass", svpass);


//svall=svip+","+svuser+","+svpass;


// SdShowMsg(svall,WAIT);


// Delay(5);


DelDataBase(svip,svuser,svpass);


DeleteFile (INSTALLDIR^"database\\kill.out");


Enable(STATUSEX);


end;


//////////////////////////


// 創建和優化數據庫


//////////////////////////


function CreateDataBase(svSQLsvr,svSQLusr,svSQLpwd)


STRING szCmdLine1,szWaitTxt,szdatabase,szdatabase1,path,path1,path3;


begin


path=INSTALLDIR^"database\\fenoffice.mdf";


path3=INSTALLDIR^"database\\fenoffice_log.ldf";


szWaitTxt=" 正在創建數據庫....";


SdShowMsg (szWaitTxt, TRUE);


Delay(2);


//CopyFile(SUPPORTDIR^"kill.sql",INSTALLDIR^"database\\kill.sql");


CopyFile(SUPPORTDIR^"fenoffice.mdf",INSTALLDIR^"database\\fenoffice.mdf");


CopyFile(SUPPORTDIR^"fenoffice_log.ldf",INSTALLDIR^"database\\fenoffice_log.ldf");


//szCmdLine="hello";


szdatabase = "/U "+svSQLusr+" /P "+svSQLpwd+" /S "+svSQLsvr+" /Q \"exec sp_attach_db N'fenoffice' , N'"+path+"',N'"+path3+"'\"";


//SdShowMsg(szdatabase,WAIT);


//Delay(3);


if (LaunchAppAndWait("osql.exe", szdatabase,WAIT)<0) then;


MessageBox ("數據庫創建失敗!請確您的系統中已安裝 Microsoft SQL Server 2000.\n如仍無法解決,請聯系系統供應商!",SEVERE);


endif;


path1=INSTALLDIR^"database";


//szdatabase1=" -S "+svSQLusr+" -U "+svSQLusr+" -P "+svSQLpwd+" -d master -n -i "+path1+"\\kill.sql -o "+path1+"\\kill.out";


//SdShowMsg(szdatabase2,WAIT);


//Delay(3);


if (LaunchAppAndWait("osql.exe", szdatabase1,WAIT)<0) then


MessageBox ("配置數據庫失敗!請嘗試手動配置!",SEVERE);


endif;


SdShowMsg (szWaitTxt, FALSE);


return 0;


end;


//


//


//檢測是否安裝了iis


//


//


function CheckIIS()


NUMBER nvType, nvSize;


STRING svvalue;


begin


RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );


if (RegDBKeyExist ("System\\CurrentControlSet\\Services\\IISADMIN" ) = 1) then


return (1);


else


return (0);


endif;


end;


//


//


//檢測ie的版本


//


//


function Checkie()


NUMBER nvType, nvSize;


STRING svvalue,szKey,szName;


begin


szKey="SOFTWARE\\Microsoft\\Internet Explorer";


szName="version";


RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );


RegDBGetKeyValueEx(szKey, szName, nvType, svvalue, nvSize );


if(svvalue="6.0.2600.0000")then


return (0);


else


return (1);


endif;


end;


//


//檢測mdac的版本


//


//


function Checkmdac()


NUMBER nvType, nvSize;


STRING svvalue,szKey,szName;


begin


szKey="SOFTWARE\\Microsoft\\DataAccess";


szName="version";


RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );


RegDBGetKeyValueEx(szKey, szName, nvType, svvalue, nvSize );


if(svvalue="2.71.9030.9") then


return (0);


else


return (1);


endif;


end;


//


//


//Write dbconn.ini file


//


//


function Writeini(svSQLsvr,svSQLusr,svSQLpwd)


string svDate,iniFile,svResult,szInfo,szWaitTxt;


NUMBER nvResult;


begin


//szWaitTxt="正在配置系統文件,請稍侯....";


iniFile =SUPPORTDIR^"dbconn.ini";


//SdShowMsg (szWaitTxt, TRUE);


// Delay(2);


if (GetSystemInfo (DATE, nvResult, svResult) < 0) then


szInfo = "不能得到系統時間";


else


svDate=svResult+" ";


endif;


if (GetSystemInfo (TIME, nvResult, svResult) < 0) then


szInfo = "不能得到系統時間";


else


svDate=svDate+svResult;


endif;


if (WriteProfString(iniFile,"dbconnection","server", svSQLsvr) <0) then


MessageBox("dbconn.ini錯誤,系統將無法運行!", SEVERE);


endif;


if (WriteProfString(iniFile,"dbconnection","ip", svSQLsvr) <0) then


MessageBox("dbconn.ini錯誤,系統將無法運行!", SEVERE);


endif;


if (WriteProfString(iniFile,"dbconnection","db_user",svSQLusr) <0) then


MessageBox("dbconn.ini錯誤,系統將無法運行!", SEVERE);


endif;


if (WriteProfString(iniFile,"dbconnection","db_pass",svSQLpwd) <0) then


MessageBox("dbconn.ini錯誤,系統將無法運行!", SEVERE);


endif;


if (WriteProfString(iniFile,"dbconnection","database", "fenoffice") <0) then


MessageBox("dbconn.ini錯誤,系統將無法運行!", SEVERE);


endif;


if (WriteProfString(iniFile,"webwork","webworkstart", svDate) <0) then


MessageBox("dbconn.ini錯誤,系統將無法運行!", SEVERE);


endif;


if (WriteProfString(iniFile,"webwork","webworkpath", INSTALLDIR) <0) then


MessageBox("dbconn.ini錯誤,系統將無法運行!", SEVERE);


endif;


CopyFile(SUPPORTDIR^"dbconn.ini",SystemFolder^"dbconn.ini");


end;


//


//注冊組件


//


function regcom()


string szLine,szWaitTxt;


begin


szLine=SystemFolder^"jmail.dll";


szWaitTxt=" 正在注冊組件....";


SdShowMsg (szWaitTxt, TRUE);


Delay(2);


CopyFile(SUPPORTDIR^"jmail.dll",SystemFolder^"jmail.dll");


if (LaunchAppAndWait("regsvr32.exe",szLine,WAIT)<0) then


MessageBox ("注冊組件失敗,請嘗試手動注冊"+szLine,SEVERE);


// else


// MessageBox ("注冊組件成功!"+szLine,INFORMATION);


//SdShowMsg (szLine, TRUE);


// Delay(3);


endif;


end;


//function deliis(VirtualFolder)


//STRING szCmdLine;


//begin


//刪除已經存在的虛擬目錄


// szCmdLine = SUPPORTDIR ^"adsutil.vbs delete w3svc/1/root/"^VirtualFolder;


// if(LaunchAppAndWait("CScript.exe", szCmdLine, WAIT)<0) then


// MessageBox ("設置iis信息服務失敗,請嘗試手動配置!",INFORMATION);


// endif;


//end;


//


//刪除數據庫


//


//


function DelDataBase(server,user,pass)


STRING szWaitTxt,szdatabase1,szdatabase2,szdatabase3,path1;


begin


szWaitTxt=" 正在刪除數據庫....";


szdatabase2 = "/U "+user+" /P "+pass+" /Q \" exec killspid N'fenoffice'";


LaunchAppAndWait("osql.exe", szdatabase2,WAIT);


//SdShowMsg(szdatabase2,WAIT);


//Delay(3);


szdatabase3 = "/U "+user+" /P "+pass+" /Q \" exec sp_dbremove N'fenoffice'" ;


LaunchAppAndWait("osql.exe", szdatabase3,WAIT);


//SdShowMsg(szdatabase3,WAIT);


//Delay(3);


SdShowMsg (szWaitTxt, FALSE);


return 0;


end;


該文章在 2010/8/19 23:57:35 編輯過
關鍵字查詢
相關文章
正在查詢...
點晴ERP是一款針對中小制造業的專業生產管理軟件系統,系統成熟度和易用性得到了國內大量中小企業的青睞。
點晴PMS碼頭管理系統主要針對港口碼頭集裝箱與散貨日常運作、調度、堆場、車隊、財務費用、相關報表等業務管理,結合碼頭的業務特點,圍繞調度、堆場作業而開發的。集技術的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業的高效ERP管理信息系統。
點晴WMS倉儲管理系統提供了貨物產品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質期管理,貨位管理,庫位管理,生產管理,WMS管理系統,標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務都免費,不限功能、不限時間、不限用戶的免費OA協同辦公管理系統。
Copyright 2010-2025 ClickSun All Rights Reserved