(1). SYSINFODuring setup initialization, InstallShield Developer sets the members of this structure variable to identify the operating platform of the target computer. By inspecting the values assigned to members of this variable, your script can determine the following information: The operating system The major and minor version number The subversion The latest service pack installed if Windows NT If the end user has adminstrator rights under Windows NT The processor type The following table shows the meaning of each SYSINFO member:Member Meaning SYSINFO.WIN9X.bWin9X If TRUE, OS is Windows 95, 98, or Millennium Edition. SYSINFO.WIN9X.bWin95 If TRUE, OS is Windows 95. SYSINFO.WIN9X.bWin98 If TRUE, OS is Windows 98. SYSINFO.WIN9X.bWinMe If TRUE, OS is Windows ME (Millennium Edition). SYSINFO.WIN9X.bSubversion_A If TRUE, OS is Windows 95 or 98 Subversion A. SYSINFO.WIN9X.bSubversion_B If TRUE, OS is Windows 95 or 98 Subversion B. SYSINFO.WIN9X.bSubversion_C If TRUE, OS is Windows 95 or 98 Subversion C. SYSINFO.WIN9X.bVersionNotFound If TRUE, OS subversion was not found for Windows 95 or 98. SYSINFO.WINNT.bWinNT If TRUE, OS is Windows NT (includes Windows 2000 and Windows XP). SYSINFO.WINNT.bWinNT4 If TRUE, OS is Windows NT 4.0. SYSINFO.WINNT.bWinXP If TRUE, OS is Windows XP. SYSINFO.WINNT.bWin2000 If TRUE, OS is Windows 2000. SYSINFO.WINNT.nServicePack The number of the installed Windows NT service pack. SYSINFO.WINNT.bAdmin_Logged_On If TRUE, end user is logged in under NT with administator rights. SYSINFO.bShellExplorer If TRUE, the shell is Explorer. SYSINFO.bIntel If TRUE, the processor is Intel. SYSINFO.nOSMajor Value indicates operating system's major version number. SYSINFO.nOSMinor Value indicates operating system's major version number. SYSINFO.nWinMajor Value indicates Windows major version number. SYSINFO.nWinMinor Value indicates Windows minor version number. ExampleThe following code fragment displays a message box if the operating platform on the target computer is Windows 98. if (SYSINFO.WIN9X.bWin98) then MessageBox("Installing on Windows 98",INFORMATION); endif;(2). GetSystemInfo Example To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release. /*--------------------------------------------------------------*\ * * InstallShield Example Script * * Demonstrates the GetSystemInfo function. * * This script uses many of the constants available for * GetSystemInfo and tests for all possible return values. * The results are displayed in a dialog box. * \*--------------------------------------------------------------*/// Include Isrt.h for built-in InstallScript function prototypes. #include "isrt.h" export prototype ExFn_GetSystemInfo(HWND);function ExFn_GetSystemInfo(hMSI) STRING szTitle, szMsg, svResult, szInfo; NUMBER nvResult; LIST listInfo; begin // Create a list for system information. listInfo = ListCreate (STRINGLIST); // Get the amount of extended memory. if (GetSystemInfo (EXTENDEDMEMORY, nvResult, svResult) < 0) then szInfo = "Couldn't get EXTENDEDMEMORY info."; else Sprintf(szInfo, "Extended memory: %d K", nvResult); endif; // Add the information to the list. ListAddString(listInfo, szInfo, AFTER); // Get the boot drive. if (GetSystemInfo (BOOTUPDRIVE, nvResult, svResult) < 0) then szInfo = "Couldn't get BOOTUPDRIVE info."; else Sprintf(szInfo, "Boot drive: %s", svResult); endif; // Add the information to the list. ListAddString(listInfo, szInfo, AFTER); // Get info about the CD-ROM. if (GetSystemInfo (CDROM, nvResult, svResult) < 0) then szInfo = "Couldn't get CD-ROM info."; else if (nvResult = 0) then svResult = "No"; else svResult = "Yes"; endif;
Sprintf(szInfo, "CDROM: %s", svResult); endif; // Add the information to the list. ListAddString(listInfo, szInfo, AFTER); // Get the video adapter. if (GetSystemInfo (VIDEO, nvResult, svResult) < 0) then szInfo = "Couldn't get VIDEO info."; else switch (nvResult) case IS_UNKNOWN: szInfo = "VIDEO: UNKNOWN"; case IS_SVGA: szInfo = "VIDEO: SVGA"; case IS_XVGA: szInfo = "VIDEO: XVGA"; case IS_UVGA: szInfo = "VIDEO: UVGA"; endswitch; endif; // Add the information to the list. ListAddString(listInfo, szInfo, AFTER); // Get number of available colors. if (GetSystemInfo (COLORS, nvResult, svResult) < 0) then szInfo = "Couldn't get COLORS info."; else Sprintf(szInfo, "Number of colors: %d", nvResult); endif; // Add the information to the list. ListAddString(listInfo, szInfo, AFTER); // Get the current date. if (GetSystemInfo (DATE, nvResult, svResult) < 0) then szInfo = "Couldn't get DATE info."; else Sprintf(szInfo, "DATE: %s", svResult); endif; // Add the information to the list. ListAddString(listInfo, szInfo, AFTER); // Get the current time. if (GetSystemInfo (TIME, nvResult, svResult) < 0) then szInfo = "Couldn't get TIME info."; else Sprintf(szInfo, "TIME: %s", svResult); endif; // Add the information to the list. ListAddString(listInfo, szInfo, AFTER); // Get the operating system. if (GetSystemInfo (OS, nvResult, svResult) < 0) then szInfo = "Couldn't get Operating System info."; else switch (nvResult) case IS_WINDOWSNT: szInfo = "OS: Windows NT"; case IS_WINDOWS9X: GetSystemInfo (WINMINOR, nvResult, svResult);
if (nvResult < 10) then szInfo = "OS: Windows 95"; else szInfo = "OS: Windows 98"; endif; endswitch; endif; // Add the information to the list. ListAddString(listInfo, szInfo, AFTER); // Display the information. szTitle = "System Information"; szMsg = "The following is some information related to your system:\n";
SYSINFODuring setup initialization, InstallShield Developer sets the members of this structure variable to identify the operating platform of the target computer. By inspecting the values assigned to members of this variable, your script can determine the following information: The operating system
The major and minor version number
The subversion
The latest service pack installed if Windows NT
If the end user has adminstrator rights under Windows NT
The processor type
The following table shows the meaning of each SYSINFO member:Member Meaning
SYSINFO.WIN9X.bWin9X If TRUE, OS is Windows 95, 98, or Millennium Edition.
SYSINFO.WIN9X.bWin95 If TRUE, OS is Windows 95.
SYSINFO.WIN9X.bWin98 If TRUE, OS is Windows 98.
SYSINFO.WIN9X.bWinMe If TRUE, OS is Windows ME (Millennium Edition).
SYSINFO.WIN9X.bSubversion_A If TRUE, OS is Windows 95 or 98 Subversion A.
SYSINFO.WIN9X.bSubversion_B If TRUE, OS is Windows 95 or 98 Subversion B.
SYSINFO.WIN9X.bSubversion_C If TRUE, OS is Windows 95 or 98 Subversion C.
SYSINFO.WIN9X.bVersionNotFound If TRUE, OS subversion was not found for Windows 95 or 98.
SYSINFO.WINNT.bWinNT If TRUE, OS is Windows NT (includes Windows 2000 and Windows XP).
SYSINFO.WINNT.bWinNT4 If TRUE, OS is Windows NT 4.0.
SYSINFO.WINNT.bWinXP If TRUE, OS is Windows XP.
SYSINFO.WINNT.bWin2000 If TRUE, OS is Windows 2000.
SYSINFO.WINNT.nServicePack The number of the installed Windows NT service pack.
SYSINFO.WINNT.bAdmin_Logged_On If TRUE, end user is logged in under NT with administator rights.
SYSINFO.bShellExplorer If TRUE, the shell is Explorer.
SYSINFO.bIntel If TRUE, the processor is Intel.
SYSINFO.nOSMajor Value indicates operating system's major version number.
SYSINFO.nOSMinor Value indicates operating system's major version number.
SYSINFO.nWinMajor Value indicates Windows major version number.
SYSINFO.nWinMinor Value indicates Windows minor version number.
ExampleThe following code fragment displays a message box if the operating platform on the target computer is Windows 98. if (SYSINFO.WIN9X.bWin98) then
MessageBox("Installing on Windows 98",INFORMATION);
endif;(2).
GetSystemInfo Example To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.
/*--------------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the GetSystemInfo function.
*
* This script uses many of the constants available for
* GetSystemInfo and tests for all possible return values.
* The results are displayed in a dialog box.
*
\*--------------------------------------------------------------*/// Include Isrt.h for built-in InstallScript function prototypes.
#include "isrt.h" export prototype ExFn_GetSystemInfo(HWND);function ExFn_GetSystemInfo(hMSI)
STRING szTitle, szMsg, svResult, szInfo;
NUMBER nvResult;
LIST listInfo;
begin // Create a list for system information.
listInfo = ListCreate (STRINGLIST); // Get the amount of extended memory.
if (GetSystemInfo (EXTENDEDMEMORY, nvResult, svResult) < 0) then
szInfo = "Couldn't get EXTENDEDMEMORY info.";
else
Sprintf(szInfo, "Extended memory: %d K", nvResult);
endif; // Add the information to the list.
ListAddString(listInfo, szInfo, AFTER); // Get the boot drive.
if (GetSystemInfo (BOOTUPDRIVE, nvResult, svResult) < 0) then
szInfo = "Couldn't get BOOTUPDRIVE info.";
else
Sprintf(szInfo, "Boot drive: %s", svResult);
endif; // Add the information to the list.
ListAddString(listInfo, szInfo, AFTER); // Get info about the CD-ROM.
if (GetSystemInfo (CDROM, nvResult, svResult) < 0) then
szInfo = "Couldn't get CD-ROM info.";
else
if (nvResult = 0) then
svResult = "No";
else
svResult = "Yes";
endif;
Sprintf(szInfo, "CDROM: %s", svResult);
endif; // Add the information to the list.
ListAddString(listInfo, szInfo, AFTER); // Get the video adapter.
if (GetSystemInfo (VIDEO, nvResult, svResult) < 0) then
szInfo = "Couldn't get VIDEO info.";
else
switch (nvResult)
case IS_UNKNOWN:
szInfo = "VIDEO: UNKNOWN";
case IS_SVGA:
szInfo = "VIDEO: SVGA";
case IS_XVGA:
szInfo = "VIDEO: XVGA";
case IS_UVGA:
szInfo = "VIDEO: UVGA";
endswitch;
endif; // Add the information to the list.
ListAddString(listInfo, szInfo, AFTER); // Get number of available colors.
if (GetSystemInfo (COLORS, nvResult, svResult) < 0) then
szInfo = "Couldn't get COLORS info.";
else
Sprintf(szInfo, "Number of colors: %d", nvResult);
endif; // Add the information to the list.
ListAddString(listInfo, szInfo, AFTER); // Get the current date.
if (GetSystemInfo (DATE, nvResult, svResult) < 0) then
szInfo = "Couldn't get DATE info.";
else
Sprintf(szInfo, "DATE: %s", svResult);
endif; // Add the information to the list.
ListAddString(listInfo, szInfo, AFTER); // Get the current time.
if (GetSystemInfo (TIME, nvResult, svResult) < 0) then
szInfo = "Couldn't get TIME info.";
else
Sprintf(szInfo, "TIME: %s", svResult);
endif; // Add the information to the list.
ListAddString(listInfo, szInfo, AFTER); // Get the operating system.
if (GetSystemInfo (OS, nvResult, svResult) < 0) then
szInfo = "Couldn't get Operating System info.";
else
switch (nvResult)
case IS_WINDOWSNT:
szInfo = "OS: Windows NT";
case IS_WINDOWS9X:
GetSystemInfo (WINMINOR, nvResult, svResult);
if (nvResult < 10) then
szInfo = "OS: Windows 95";
else
szInfo = "OS: Windows 98";
endif;
endswitch;
endif; // Add the information to the list.
ListAddString(listInfo, szInfo, AFTER); // Display the information.
szTitle = "System Information";
szMsg = "The following is some information related to your system:\n";
SdShowInfoList (szTitle, szMsg, listInfo); ListDestroy(listInfo);end;
一、所谓打包的主要目的:
让用户可以通过运行一个安装程序(我们打好的包)就可以将我们的程序装入系统中正常运行。
所需要为用户考虑的就是简单二字,我认为只要用户通过简单的操作就可以装上我们的系统,那就是一个成功的打包程序。
目前编程技术众多,之前我们要选择适合的技术,如:根据数据量数据库的选用(桌面型\数据服务器\文件..)、数据库连接方式的选择(ADO\BDE\ODBC\DBEXPRSS..)、是否使用注册表、INI文件的使用等。
在做好程序之后,我们只需将程序所需的文件拷贝到另一台电脑上,配置一下相关的系统配置就应当可以运行了。
为什么要打包呢?有些配置方法比较复杂,用户不能接受,少量用户我们亲临现场解决也没问题,当用户量多或其它一些情况下,我们就特别需要制作一个能够自动进行系统配置的文件。
二、简单的分析一下,打包可以分为几块:
1.必要的文件(必须,没它不行!)。
2.数据库连接配置(根据情况:是否使用数据库、系统是否带有数据引擎..)。
3.注册信息(不一定都有,有的程序只需一个EXE,其它什么都不用)。
象安装界面,什么欢迎、许可、口令框之类,我们应当根据具体情况来制定,反正达到上面结果就是目的已经达到。
wise是一个好工具,使用简便。
三、如何包装必须的文件呢?
切换到安装专家页-》安装程序详细资料-》文件,该页有四个框(类似windows的资源管理器),上边两个显示的是我们电脑中的文件,下面是目标电脑的文件夹,从上面的框中选择文件夹或文件,利用添加按钮即可加入目标电脑中。
注意的一点是:
1.application是一个安装时用户选择的目录(也有可能是默认的,在“产品详细信息”中设置);
2.windows目录是用户机的系统目录,将自动处理;
3.通过双击文件对话框中的文件,可以看到文件的属性,其中有一项是源文件路径,更改路径可以连接到其它文件上,即可以将本机的不同路径下的文件打到同一个目录中,编译时,根据路径提取文件来打包。
四、注册表信息配置:
与上边的对话框非常类似,用法也相似,在上边选择本机的注册表的信息,可以添加到下边来,添加后的信息可以更改键值(与文件不同的是,本机注册表信息修改,不影响该信息的值,而文件是从本机提取的,文件更新,会提取更新后的文件)。
这些注册信息可能与你的出厂的初始设置之类有关,如果嫌麻烦,使用INI也可以,不过我觉得wise的INI设置有点多余,当普通文件打一下也可以。
五、数据库方面:
数据库配置wise有的做的就特别好,如odbc,只要你的本地机配置好了,引用一下就ok了。添加-》导入-》确定,OVER。
至于ADO,在98SE以后的版本中,基本就不用多考虑了。
BDE建议淘汰吧。
六、其它:
快捷方式:添加-》选择要连接的EXE,位置(启动菜单、桌面..),注意的一点是最好加上默认路径,如:
快截方式路径名称:%MAINDIR%\Pricemng.exe
则 默认路径:%MAINDIR%\
原因不在此多谈,暂且告一段落,谢谢读完,希望对大家有用。
我上面漏了说明:
A 程序是必须的,是能够在98/ME/NT/2000/XP下运行的,而B 程序则只能够在NT/2000/XP下运行的,
所以若用户的操作系统是NT/2000/XP下就让其自动安装,若是98/ME的话就不要安装,应该如何实现呢?