|
不知道你们从DLL 库中 调用里面的function时候 用到 micByRef参数没有:
‘VB中的声明方法
'Public Declare Function ConnectDatabase Lib "fbdll4vb20.dll" (ByVal servername As String, ByVal dbn
ame As String, ByVal username As String, ByVal password As String) As Boolean
'Public Declare Function ExecuteSelect Lib "fbdll4vb20.dll" (ByVal dmlCommand As String, ByRef retVal As String, retlen As Long) As Long
’QTP里的声明方法
Extern.Declare micInteger , "ConnectDatabase", "c:\fbdll4vb20.dll", "ConnectDatabase", micString , micString, micString , micString
Extern.Declare micInteger , "ExecuteSelect", "C:\fbdll4vb20.dll", "ExecuteSelect", micString , micString +micByRef , micInteger +micByRef
‘调用部分
。。。。
Dim rv
Dim rcount
Dim rlen
Dim result
Dim xmldoc
result = Space(1)
rv = Extern.ConnectDatabase("localhost", "c:\NRM5.GDB", "SYSDBA", "masterkey")
rcount = Extern.ExecuteSelect("SELECT name FROM profiles where id =1", result, rlen)
。。。。
结果:
rv =1 这个说明 ConnectDatabase 成功,但是 在调用ExecuteSelect,也就是Select的结果 写回到 result 或者 rlen的时候,系统报错“General Error”。
我比较头痛,对 micString +micByRef 换了各种类型都无济于事,查过Mercury KnowledgeBase
那里面的例子也没什么特别的。另外发现调用DLL里的function对于QTP时比较危险的,很容易就会造成整个QTP系统Crash掉。
这条路走不通 我只能换办法了,呵呵! |
|