installshield6.3专业版中可以使用动态库;用法如下:
出于对InstallShield函数功能的扩展,InstallShield专业版还允许用户使用外部DLL中的函数,其使用步骤如下:
(1) 首先使用下列形式在主程序体program前声明所要使用的DLL函数: prototype .<函数名> ( 形参类型列表 ); (2) 然后,使用UseDLL函数将DLL文件调入内存;
(3) 接着,用下列形式调用已声明过的DLL函数;
函数名 ( 实参 );
(4) 最后,使用 UnUseDLL将DLL文件从内存中释放出来。 [例Ex_DLL] 使用DLL函数。 #define DLL_FILE "C:\\EXAMPLE\\DLLS\\MSVC\\MSC\\EXAMPLE\\WINDEBUG\\MYDLL.DLL"
// 声明在MYDLL.DLL文件中的MydllReturn函数
prototype MYDLL.MydllReturn( INT, POINTER );
STRING szDLL, svString;
INT nValue;
POINTER psvString;
NUMBER nResult;
BOOL bDone;
program szDLL = DLL_FILE; /*--------------------------------------------------------------------------* * 将MYDLL.DLL文件调入内存。
\*--------------------------------------------------------------------------*/
nResult = UseDLL (szDLL); if (nResult = 0) then
MessageBox ("UseDLL successful \n\n.DLL file loaded.", INFORMATION);
else
MessageBox ("UseDLL failed.\n\nCouldn’t load .DLL file.", INFORMATION);
abort;
endif;
bDone = FALSE; while (bDone != TRUE)
Disable(BACKBUTTON);
AskText("Enter an example string.", "Example string.", svString);
psvString = &svString;
nValue = StrLength(svString); // 调用DLL函数
MydllReturn(nValue, psvString); SprintfBox(INFORMATION, "UseDLL", "MydllReturn() changed the string " +
"to: %s", svString); // 由用户控制while循环的终止
if (AskYesNo("Do another example?", YES) = NO) then
bDone = TRUE;
endif;
endwhile;
/*--------------------------------------------------------------------------** 将MYDLL.DLL文件从内存中释放出来。
\*--------------------------------------------------------------------------*/
if (UnUseDLL (szDLL) < 0) then
MessageBox("UnUseDLL failed.\n\nDLL still in memory.", SEVERE);
else
MessageBox("UnUseDLL successful.\n\n.DLL file removed from memory.",
INFORMATION);
endif; endprogram
出于对InstallShield函数功能的扩展,InstallShield专业版还允许用户使用外部DLL中的函数,其使用步骤如下:
(1) 首先使用下列形式在主程序体program前声明所要使用的DLL函数: prototype .<函数名> ( 形参类型列表 ); (2) 然后,使用UseDLL函数将DLL文件调入内存;
(3) 接着,用下列形式调用已声明过的DLL函数;
函数名 ( 实参 );
(4) 最后,使用 UnUseDLL将DLL文件从内存中释放出来。 [例Ex_DLL] 使用DLL函数。 #define DLL_FILE "C:\\EXAMPLE\\DLLS\\MSVC\\MSC\\EXAMPLE\\WINDEBUG\\MYDLL.DLL"
// 声明在MYDLL.DLL文件中的MydllReturn函数
prototype MYDLL.MydllReturn( INT, POINTER );
STRING szDLL, svString;
INT nValue;
POINTER psvString;
NUMBER nResult;
BOOL bDone;
program szDLL = DLL_FILE; /*--------------------------------------------------------------------------* * 将MYDLL.DLL文件调入内存。
\*--------------------------------------------------------------------------*/
nResult = UseDLL (szDLL); if (nResult = 0) then
MessageBox ("UseDLL successful \n\n.DLL file loaded.", INFORMATION);
else
MessageBox ("UseDLL failed.\n\nCouldn’t load .DLL file.", INFORMATION);
abort;
endif;
bDone = FALSE; while (bDone != TRUE)
Disable(BACKBUTTON);
AskText("Enter an example string.", "Example string.", svString);
psvString = &svString;
nValue = StrLength(svString); // 调用DLL函数
MydllReturn(nValue, psvString); SprintfBox(INFORMATION, "UseDLL", "MydllReturn() changed the string " +
"to: %s", svString); // 由用户控制while循环的终止
if (AskYesNo("Do another example?", YES) = NO) then
bDone = TRUE;
endif;
endwhile;
/*--------------------------------------------------------------------------** 将MYDLL.DLL文件从内存中释放出来。
\*--------------------------------------------------------------------------*/
if (UnUseDLL (szDLL) < 0) then
MessageBox("UnUseDLL failed.\n\nDLL still in memory.", SEVERE);
else
MessageBox("UnUseDLL successful.\n\n.DLL file removed from memory.",
INFORMATION);
endif; endprogram
function OnDogDialog()
BOOL bDone;
NUMBER nCmdValue,nResult;
NUMBER nCount;
STRING szDialogName;
begin
szDialogName="MyDog";
EzDefineDialog( szDialogName, "", "", DLG_TEMDOG);//对话框ID
bDone = FALSE;
repeat
nCmdValue = WaitOnDialog(szDialogName);
switch (nCmdValue)
case DLG_INIT:
//Disable(NEXTBUTTON);
case IDC_BUTTONRETRY:
bDone = TRUE;
nResult = IDC_BUTTONRETRY;
case SD_PBUT_EXITSETUP:
HandleExit();
case IDC_BUTTONCONTINUE:
bDone = TRUE;
nResult = IDC_BUTTONCONTINUE;
case DLG_CLOSE:
bDone = TRUE;
case DLG_ERR:
MessageBox("内部的对话框错误!", SEVERE);
bDone = TRUE;
endswitch;
until bDone;
EndDialog(szDialogName);
ReleaseDialog (szDialogName);
return nResult;
end;