由于http://blog.youkuaiyun.com/dragoo1/article/details/44758243里的对话框比较简单,没有edit赋值,取值,操作,这里多写一点,先在对话框添加一个edit
#define DLG_MYDLG "MyDlg" //MyDlg是我们的对话框名字
#define HELLOBTN 1302 //1302就是我们那个按钮的Control Identifer属性值
#define SD_EDIT_CUSTOM_NAME 1303 //1303是编辑框的Control Identifer属性值
prototype NUMBER MyDlg(BYREF STRING, BYREF STRING);
function NUMBER MyDlg(msg, svName)
HWND hDlg;
NUMBER nId, nResult;
NUMBER nControl;
BOOL bDone;
begin
// ensure general initialization is complete
if (!bSdInit) then
SdInit( );
endif;
//初始对话框函数
if (EzDefineDialog( DLG_MYDLG,ISUSER , "MyDlg", 0 ) = DLG_ERR) then
return ISERR_GEN_FAILURE;
endif;
bDone = FALSE;
//循环
while (!bDone)
nId = WaitOnDialog( DLG_MYDLG );//获得对话框的消息
switch (nId)
case DLG_INIT:
CtrlSetText( DLG_MYDLG, SD_EDIT_CUSTOM_NAME, svName );
hDlg = CmdGetHwndDlg( DLG_MYDLG );
SdGeneralInit( DLG_MYDLG, hDlg, STYLE_BOLD, szSdProduct );
case HELLOBTN: //如果是HELLOBTN
MessageBox(msg,WARNING);
bDone=TRUE;
case DLG_ERR:
nId = ISERR_GEN_FAILURE;
SdError(nId, DLG_MYDLG);
bDone = TRUE;
case DLG_CLOSE:
SdCloseDlg(hDlg, nId, bDone);
default:
// check standard handling
if (SdIsStdButton(nId) && SdDoStdButton(nId)) then
bDone = TRUE;
endif;
endswitch;
endwhile;
CtrlGetText( DLG_MYDLG, SD_EDIT_CUSTOM_NAME, svName );
EndDialog( DLG_MYDLG );
ReleaseDialog( DLG_MYDLG );
SdUnInit( );
return nId;
end;
参考:D:\Program Files\InstallShield\2014\Samples\InstallScript\Serial Number Validation Sample Project\Script Files\Custom_Password.rul