InstallShield不执行脚本, 高手过来指点下(100分)

  • 主题发起人 主题发起人 cking331
  • 开始时间 开始时间
C

cking331

Unregistered / Unconfirmed
GUEST, unregistred user!
Setup.rul文件代码如下:
////////////////////////////////////////////////////////////////////////////////
//
// IIIIIII SSSSSS
// II SS InstallShield (R)
// II SSSSSS (c) 1996-2002, InstallShield Software Corporation
// II SS All rights reserved.
// IIIIIII SSSSSS
//
//
// This template script provides the code necessary to build an entry-point
// function to be called in an InstallScript custom action.
//
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
////////////////////////////////////////////////////////////////////////////////
// Include Ifx.h for built-in InstallScript function prototypes, for Windows
// Installer API function prototypes and constants, and to declare code for
// the Onbegin
and OnEnd events.
#include "ifx.h"
// The keyword export identifies MyFunction() as an entry-point function.
// The argument it accepts must be a handle to the Installer database.
export prototype MyFunction(HWND);

// Todo
: Declare global variables, define constants, and prototype user-
// defined and DLL functions here.

// Todo
: Create a custom action for this entry-point function:
// 1. Right-click on "Custom Actions" in the Sequences/Actions view.
// 2. Select "Custom Action Wizard" from the context menu.
// 3. Proceed through the wizard and give the custom action a unique name.
// 4. Select "Run InstallScript code" for the custom action type, and in
// the next panel select "MyFunction" (or the new name of the entry-
// point function) for the source.
// 5. Click Next, accepting the default selections until the wizard
// creates the custom action.
//
// Once you have made a custom action, you must execute it in your setup by
// inserting it into a sequence or making it the result of a dialog's
// control event.
///////////////////////////////////////////////////////////////////////////////
//
// Function: MyFunction
//
// Purpose: This function will be called by the script engine when
// Windows(TM) Installer executes your custom action (see the "To
// do
," above).
//
///////////////////////////////////////////////////////////////////////////////
function MyFunction(hMSI)
// Todo
: Declare local variables.
begin

MessageBox("1", SEVERE);
// Todo
: Write script that will be executed when MyFunction is called.

end;

function OnFirstUIAfter()
string szTitle, szMsg1, szMsg2, szOption1, szOption2, szFilename;

number bOpt1, bOpt2, nResult;

begin

Disable(STATUSEX);

bOpt1 = FALSE;

bOpt2 = FALSE;

szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);

SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);

//生成UnInstall的开始菜单快捷方式
szFilename = UNINSTALL_STRING;

nResult = StrFind(szFilename, ".exe");

if ((StrFind(szFilename, "/"") < 0) &amp;&amp;
(nResult >= 0)) then

StrSub(szMsg1, szFilename, 0, nResult + 4);

StrSub(szMsg2, szFilename,nResult + 4, 200);

szFilename = "/"" + szMsg1 + "/"" + szMsg2;

UNINSTALL_STRING = szFilename;

endif;


AddFolderIcon("BKSoft//BKMIS", "卸载MIS系统", szFilename, INSTALLDIR, WINDIR^"System32//msiexec.exe", 0, "", NULL);

end;


prototype CreateUninstallShortcut();
function CreateUninstallShortcut()
string strCmdLine;

LIST lstPath;
begin

MessageBox("1", SEVERE);
// For an InstallScript installation:
strCmdLine = DISK1TARGET ^ 'Setup.exe';

// For an InstallScript MSI installation:
strCmdLine = UNINSTALL_STRING;


// The path has to be handled differently if you are running
// an InstallScript MSI installation on Windows 9X.
if ( SYSINFO.WIN9X.bWin9X ) then

lstPath = ListCreate(STRINGLIST);

StrGetTokens(lstPath, UNINSTALL_STRING, '/');


ListGetFirstString(lstPath, strCmdLine);

LongPathToQuote(strCmdLine, TRUE);


strCmdLine = strCmdLine + ' /M' + PRODUCT_GUID;
endif;

// Create the shortcut.
AddFolderIcon(FOLDER_PROGRAMS ^ 'Uninstall Shortcut', 'Run the Uninstall',strCmdLine, '','',0, '', NULL );

end;

function Onbegin
()
string sMsg;
begin
sMsg = "提示";
MessageBox(sMsg, SEVERE);
abort;
end;
 
没有人知道吗?
 
改为function DT_IssueCard(AIssueDtInfo: TIssueDtInfo): Integer;
stdcall;呢
 
对C#不了解,你测试下直接传PChar可以吗?
function DT_IssueCard(APass;
PChar): Integer;
stdcall;
 
你的 OCX 是 ActiveForm还是 COM?
 
把PChar换成WideString
 
我的是OCX, 说明,1:我开始用WideString不行,网上查询资料说Dll支持多语言不能用string, 才改成Pchar的。
2:接口关键字是Delphi自动生成的, safecall。
 
function DT_IssueCard(AIssueDtInfo: TIssueDtInfo): Integer;
safecall;
改成
function DT_IssueCard(password:pchar): Integer;
safecall;
这样就OK了 其实很简单的
c#里面用STRING类型传进去
你以前的做法参数类型是个复杂类型
那么在C#里面也要有相同的类型,那样就复杂了。还是老老实实的用PCHAR做参数就可以了。
 
多人接受答案了。
 
后退
顶部