Psafearray参数传递(100)

  • 主题发起人 主题发起人 lawrencehjr
  • 开始时间 开始时间
L

lawrencehjr

Unregistered / Unconfirmed
GUEST, unregistred user!
小弟做某软件二次开发要用Psafearray作参数传递,我对这种格式一窍不通, 高手看过来啊先贴帮助文档的vb函数定义VB6 ProcedureFunction JointDispl(ByVal Name As String, ByVal ItemTypeElm As eItemTypeElm, ByRef NumberResults As Long, ByRef Obj() As String, ByRef Elm() As String, ByRef LoadCase() As String, ByRef StepType() As String, ByRef StepNum() As Double, ByRef U1() As Double, ByRef U2() As Double, ByRef U3() As Double, ByRef R1() As Double, ByRef R2() As Double, ByRef R3() As Double) As Long再贴tlb文件的定义 function JointDispl(const name: WideString; ItemTypeElm: eItemTypeElm; var NumberResults: Integer; var obj: PSafeArray; var elm: PSafeArray; var LoadCase: PSafeArray; var StepType: PSafeArray; var StepNum: PSafeArray; var U1: PSafeArray; var U2: PSafeArray; var u3: PSafeArray; var R1: PSafeArray; var R2: PSafeArray; var R3: PSafeArray): Integer; safecall;下面是我实现的部分代码var vObj: PSafeArray; vElm: PSafeArray; vLoadCase:PSafeArray; vStepType: PSafeArray; vStepNum:PSafeArray; vU1,vU2,vU3: PSafeArray; vR1,vR2,vR3: PSafeArray; SAbound : SAFEARRAYBOUND; ret :integer;......begin...... SAbound.lLbound :=0; SAbound.cElements :=1;vObj := SafeArrayCreate(VT_BSTR,1,SAbound); vElm := SafeArrayCreate(VT_BSTR,1,SAbound); vLoadCase := SafeArrayCreate(VT_BSTR,1,SAbound); vStepType := SafeArrayCreate(VT_BSTR,1,SAbound); vStepNum := SafeArrayCreate(varDouble,1,SAbound); vU1 := SafeArrayCreate(varDouble,1,SAbound);... ret := FModel.Results.JointDispl(PointName[1],ObjectElm,NumberResults, vObj,vElm,vLoadCase,vStepType,vStepNum,vU1,vU2,vU3,vR1,vR2,vR3 );调用之后的Psafearray类型的参数该怎么读另外, 如果程序有 SafeArrayDestroy(vObj); SafeArrayDestroy(vElm); SafeArrayDestroy(vLoadCase); SafeArrayDestroy(vStepType); SafeArrayDestroy(vStepNum); SafeArrayDestroy(vU1);...运行时就会有错误, 不用SafeArrayDestroy就不报错, 这咋回事啊
 
最近招聘火爆啊, 沉的这么快
 
后退
顶部