设为首页 加入收藏

TOP

installshield调用第三方dll文件
2014-11-24 03:26:53 】 浏览:1506
Tags:installshield 调用 第三方 dll 文件

在卸载程序时需要调用dll文件释放license,研究了下怎样去掉用第三方dll文件。

首先看官方的例子:

/*--------------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the UseDLL and the UnUseDLL functions.
*
* UseDLL is called to load an example .dll file into memory.  A
* function in this .dll file is then called to demonstrate how
* .dll functions can be used in an installation.  Finally,
* UnUseDLL is called to unload the example .dll file from memory.
*
* Note: This script requires that the constant DLL_FILE be set
*       to the fully qualified name of a .dll file that contains
*       a function called MydllReturn.  The format of that
*       function must match the prototype declaration below.
*
\*--------------------------------------------------------------*/
 
#define DLL_FILE "MyDLL.dll"
 
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
 
 
    // Prototype MydllReturn in Mydll.dll.
    prototype  Mydll.MydllReturn (INT, POINTER);
export prototype ExFn_UseDLL(HWND);
 
function ExFn_UseDLL(hMSI)
    STRING  svString;
    INT     nValue;
    POINTER psvString;
    NUMBER  nResult;
    BOOL    bDone;
begin
 
    // Load the .dll file into memory.
    nResult = UseDLL (DLL_FILE);
 
    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 controls the following while loop.
    bDone = FALSE;
 
    // Loop while bDone is FALSE.
    while (bDone = FALSE)
        // Disable the Back button in installation dialogs.
        Disable (BACKBUTTON);
 
        // Get a string from the user.
        AskText ("Enter an example string.", "Example string.", svString);
 
        // Get a pointer to the string to pass to MydllReturn.
        psvString = &svString;
 
        // Get the string length to pass to MydllReturn.
        nValue = StrLength (svString);
 
        // Call MydllReturn.
        MydllReturn (nValue, psvString);
 
        // Display the string to observe how it was altered by MydllReturn.
        SprintfBox (INFORMATION, "UseDLL", "MydllReturn() changed the string " +
                   "to: %s", svString);
 
        // Give the user a chance to do another example.
        if (AskYesNo ("Do another example ", YES) = NO) then
            bDone = TRUE;
        endif;
    endwhile;
 
    // Remove the .dll file from memory.
    if (UnUseDLL (DLL_FILE) < 0) then
        MessageBox ("UnUseDLL failed.\n\n.dll file still in memory.", SEVERE);
    else
        MessageBox ("UnUseDLL successful.\n\n.dll file removed from memory.",
                   INFORMATION);
    endif;
 
end;

说明:

文件名:Mydll.dll

声明:prototype Mydll.MydllReturn (INT, POINTER);

prototype [CallingConvention] [ReturnType] DLLName.FunctionName( ParamType1, ParamType2, ... );

调用:UseDLL (DLL_FILE)

释放:UnUseDLL


注意:

使用时请注意两个关键词(搜索一下看看):

cdecl

BYREF

官方帮助文档:http://helpnet.installshield.com/installshield20helplib/installshield20helplib.htm

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Bridge设计模式 + FilenameFilter.. 下一篇Hibernate的映射(关联)

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目