InstallShield 创建自己的Dialog

1.在“User Interface”-“Dialogs”下,在All Dialogs右击“New Dialogs…”创建自己的Dialogs。

2.在“Behavior and Logic”-“InstallScript”下,在Files右击“New Script File”创建相应函数

SdMakeName

if(MODE = SILENTMODE) then
      SdMakeName(szAppKey, DLG_ENTERLOGIN, "", nDlgEnterLogin);
      SilentReadData(szAppKey, "Result", DATA_NUMBER, szNil, nId);
      if((nId != BACK) && (nId != CANCEL)) then
          SilentReadData( szAppKey, "szUser", DATA_STRING, svUser, nNil );
          SilentReadData( szAppKey, "szPass", DATA_STRING, svPassword, nNil );
      endif;
      return nId;
  endif;

SdMakeName ( svSection, szDlg, szUnused, nvDlgName );

svSection :Specifies the section name (for example, "MyDlg-0"). InstallShield places a value into this variable using the variables szDlg and nvDlgName. This value is used by SilentReadData and SilentWriteData.

svSection:指定这个名字是为了SilentReadData和SilentWriteData使用。

szDlg: Specifies the name of the custom dialog (for example, "MyDlg") for which to create a section name.

szDlg:变量的名字是自己创建的Dialog的名字。

szUnused:This parameter is not used; pass a null string ("") in this parameter.

szUnused:没有实质的作用,传入空字符就可以。

nvDlgName: Specifies the counter that records the number of times SdMakeName is called for the dialog named in szDlg. InstallShield automatically increments this counter.

For sections to be properly named, you must use a unique variable name in this parameter for each different custom dialog. A simple way to do this is to use the dialog name in szDlg to name the variable. For example, when szDlg is "MyDlgOne," name the variable in this parameter nvMyDlgOne, and when szDlg is "MyDlgTwo," name the variable nvMyDlgTwo.

nvDlgName:传入一个唯一的名字。(其实不太清楚)

Return Values

None.

SilentReadData

SilentReadData(szAppKey, "Result", DATA_NUMBER, szNil, nId);

//-----------------------------------我是注释,你不懂哥的寂寞------------------------------------------

SilentReadData (szSection, szValName, nValType, svVal, nvVal);

//个人认为第一次写这个是默认的,第二次是自己定义的。

szSection:

Specifies the name of the dialog data section in the .iss file. Do not include the square brackets ( [ ] ). The parameter szSection takes the form <functionname>-<number>, where <functionname> is the name of the dialog function as it is used in the script, and <number> is the number of the occurrence of that dialog in the script, beginning with 0 (zero). For example, the first occurrence of the MyDialog function dialog would have a value of "MyDialog-0" in szSection, the second occurrence "MyDialog-1," the third "MyDialog-2," and so on.

szSection:同SdMakeName中的第一个参数。

szValName:

Specifies the value name that appears in the dialog data section of the .iss file. Every dialog has at least one value for szValName—"Result"—which identifies the value returned by the dialog button controls (BACK, NEXT, OK, or CANCEL). Other value names are used to identify values and data associated with the other dialog controls.

szValName:指定在文件.iss中出现的内容。

nValType:

  • DATA_STRING—The value assigned to the value name in szValName is of type STRING. Its value will be stored in svVal.

  • DATA_NUMBER—The value assigned to the value name in szValName is of type NUMBER. Its value will be stored in nvVal.

  • DATA_COMPONENT—The value assigned to the value name in szValName is the name of a component It will be stored in svVal.

  • DATA_LIST—The value assigned to the value name in szValName is the list ID for an InstallScript list. It will be stored in nvVal.

nValType:

  • DATA_STRING—字符串类型的保存在svVal中.

  • DATA_NUMBER—整数类型的保存在svVal中.

  • DATA_COMPONENT—.

  • DATA_LIST—列表内容保存svVal中.

svVal:Specifies the value assigned to the value name in szValName when nValType is DATA_STRING or DATA_COMPONENT.

svVal:当nValType是DATA_STRING和DATA_COMPONENT时,把值保存在svVal中。

nvVal:Specifies the value assigned to the value name in szValName when nValType is DATA_NUMBER or DATA_LIST.

nvVal:当nValType是DATA_NUMBER和DATA_LIST时,把值保存在nvVal中。

CtrlSetText

#define RES_PBUT_BACK        12   // ID of Back button

#define RES_EDITNAME        301   // ID of edit box

#define RES_EDITCOMPANY     302   // ID of edit box

CtrlSetText (szDialogName, RES_EDITNAME, "Your name");

CtrlSetText (szDialogName, RES_EDITCOMPANY, "Your company");

CtrlSetText (szDialogName, nControlID, szText);

参数:     

      szDialogName指定一个对话框的名称。
nControlID指定其中的文本要被设置的单行编辑区,静态文本区或按扭控件的资源ID。
szText指定放到控件中的文本。

返回值:
0:CtrlSetText成功设置控件中的文本。
< 0:CtrlSetText未能设置控件中的文本。

CtrlGetText

今天到这里,明天继续。。。。。

你可能感兴趣的:(Install)