代码如下:
在VC中:
extern "C" __declspec(dllexport) LONG APIENTRY CheckKey(HWND hwnd, LPLONG lpIValue, LPSTR lpszValue)
{
MessageBox(hwnd, "ok", "ok", MB_OK);
return 42;
}在InstallShield中:
szDLL = SUPPORTDIR ^ "InstDLL.DLL";
szFunction = "CheckKey";
nValue = 0;
szValue = "";
nRet = CallDLLFx(szDLL, szFunction, nValue, szValue); //nRet 总是返回 -1请问这是怎么回事呀?
在VC中:
extern "C" __declspec(dllexport) LONG APIENTRY CheckKey(HWND hwnd, LPLONG lpIValue, LPSTR lpszValue)
{
MessageBox(hwnd, "ok", "ok", MB_OK);
return 42;
}在InstallShield中:
szDLL = SUPPORTDIR ^ "InstDLL.DLL";
szFunction = "CheckKey";
nValue = 0;
szValue = "";
nRet = CallDLLFx(szDLL, szFunction, nValue, szValue); //nRet 总是返回 -1请问这是怎么回事呀?
szDLL = SUPPORTDIR ^ @"InstDLL.DLL";
或者是
szDLL = SUPPORTDIR @^ "InstDLL.DLL";
具体我也几不清了
你再试试啊
首先将dll加入language independent--->operation system independent里面.
先声明:
#define DLL_FILE "Setup00.dll"
////////////////////// string defines //////////////////////////////////////////////// installation declarations ///////////////////// ----- DLL function prototypes -----
// your DLL function prototypes
// ---- script function prototypes -----
// your script function prototypes
prototype INT Setup00.Test(BYREF STRING,INT);
// your global variables
STRING szDLL, svString;
INT nValue;
POINTER psvString;
BOOL bDone;
//NUMBER nResult; 代码调用如下: szDLL = SUPPORTDIR ^DLL_FILE;
/*--------------------------------------*\
* Load SETUP00.DLL into memory.
\*--------------------------------------*/
MessageBox (szDLL, INFORMATION);
nResult = UseDLL (szDLL);
if (nResult = 0) then
MessageBox ("动态库调入内存成功!", INFORMATION);
else
MessageBox ("动态库调入内存失败!", INFORMATION);
abort;
endif;
AskText("请输入示例字符串:", "这是示例字符串", svString);
nValue = StrLength(svString);
nResult = Test(svString,nValue);
// 显示调用Setup00.dll中Test函数后的字符串
SprintfBox(INFORMATION, "调用动态库", "调用后的字符串为:%s ", svString);
if (UnUseDLL (szDLL) < 0) then
MessageBox("卸载动态库失败,仍在内存中!", SEVERE);
else
MessageBox("从内存中卸载动态库成功!",INFORMATION);
endif;
http://www.impu.edu.cn/learner/aboutvc/installshieldselfdll.htm