///////////////////////////////////////////////////////////////////////////////
//
// function: onmaintuiafter
//
// event: maintuiafter event is sent after file transfer, 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 that will inform
// end user that maintenance/uninstallation has been completed successfully.
//
///////////////////////////////////////////////////////////////////////////////
function onmaintuiafter()
string sztitle, szmsg1, szmsg2, szoption1, szoption2;
number bopt1, bopt2;
begin
disable(statusex);
bopt1 = false;
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);
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
//
// function: onmoving
//
// event: moving event is sent when file transfer is started as a result of
// componenttransferdata call, before any file transfer operations
// are performed.
//
///////////////////////////////////////////////////////////////////////////////
function onmoving()
string szapppath;
begin
// set logo compliance application path
// to do : if your application .exe is in a subfolder of targetdir then add subfolder
szapppath = targetdir;
regdbsetitem(regdb_apppath, szapppath);
regdbsetitem(regdb_apppath_default, szapppath ^ @product_key);
end;
// — include 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
if (mode=silentmode) then
sdmakename( szappkey, szdlg, sztitle, nloginsql );
silentreaddata( szappkey, "result", data_number, sztemp, nid );
if ((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 );
endif;
return nid;
endif;
// ensure general initialization is complete
if (!bsdinit) then
sdinit();
endif;
if (ezdefinedialog( szdlg, "", "",dlg_loginsqlsv ) = dlg_err) then
return -1;
endif;
// 在用户选择标准按钮前进行循环
bdone = false;
while (!bdone)
nid = waitondialog( szdlg );//显示对话框
hwndcontrol = getdlgitem (hwnddlg, sd_edit_sqlsv_name);
setfocus (hwndcontrol);
switch(nid)
case 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 sets the caption for old style dialogs or
//sets the text in the top banner area of win2k style dialogs
sdsetdlgtitle(szdlg, hwnddlg, sztitle);
case sd_edit_sqlsv_name:
nmessage = ctrlgetsubcommand( szdlg );
if( nmessage = editbox_change ) then
ctrlgettext( szdlg, sd_edit_sqlsv_name, szsqlsvname );
endif;
case sd_edit_sqlsv_user:
nmessage = ctrlgetsubcommand( szdlg );
if( nmessage = editbox_change ) then
ctrlgettext( szdlg, sd_edit_sqlsv_user, szsqluser );
endif;
case sd_edit_sqlsv_password:
nmessage = ctrlgetsubcommand( szdlg );
if( nmessage = editbox_change ) then
ctrlgettext( szdlg, sd_edit_sqlsv_password, szsqlpassword );
endif;
case ok:
nid = next;
bdone = true;
case back:
nid = back;
bdone = true;
case dlg_err:
sderror( -1, "sdwelcome" );
nid = -1;
bdone = true;
case dlg_close:
sdclosedlg( hwnddlg, nid, bdone );
default:
// check standard handling
if (sdisstdbutton( nid ) && sddostdbutton( nid )) then
bdone = true;
endif;
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 );
return nid;
end;
function exesqlfile( szsqlfilename )
string szcmdline;
number ntemp;
begin
szcmdline = supportdir ^"osql.exe";
if (launchappandwait(supportdir ^"osql.exe", szsqlfilename,wait) < 0) then
messagebox ("不能运行sql安装文件.",severe);
endif;
end;
function modifdbdir()
string szinstallfile;
number nvresult,nvlinenumber;
string szwindir,svreturnline;
number sn,nstartpos;
string sz1,sz2,sznewdir;
number ntemp;
begin
szinstallfile = targetdir ^"install\\createdb.sql";
//替换 db文件的建立路径
while (nvresult != end_of_file)
nvresult = filegrep (szinstallfile, "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);
sznewdir=sz1+targetdir ^sz2;
fileinsertline(szinstallfile, sznewdir,nvlinenumber, replace);
sz1="";
sz2="";
sznewdir="";
endwhile;
end;
//////////////////////////////////////////////////////////////////////////////
//
// function: onfilereadonly
//
// event: filereadonly event is sent during file transfer when a read-only
// file is needs to be overwritten or removed.
//
// arguments: file – full path of file that is marked as read-only.
//
// return: err_yes – the file should be overwritten or removed.
// err_no – the file should not be modified.
//
///////////////////////////////////////////////////////////////////////////////
function onfilereadonly(file)
begin
return sdexceptions(readonly, file);
end;
//////////////////////////////////////////////////////////////////////////////
//
// function: onfilereadonly
//
// event: filereadonly event is sent during file transfer when a read-only
// file is needs to be overwritten or removed.
//
// arguments: file – full path of file that is marked as read-only.
//
// return: err_yes – the file should be overwritten or removed.
// err_no – the file should not be modified.
//
