venkat001
13 years agoOccasional Contributor
Calling dll from TestComplete script
Hi,
I'm writing a TestComplete script to pass arguments (int) to AQ_SetStart function in dll (dll is wrriten inV C++). Below is my C++ code for dll functions. While executing this TestComplete script, getting below error . And appreciate your early help.
Error
**************************************************
An exception occurred in the "Unit1" unit at line 38:
Microsoft VBScript runtime error
Object doesn't support this property or method: 'Lib.AQ_SetStart'An exception occurred in the "Unit1" unit at line 38:
Microsoft VBScript
runtime error
Object doesn't support this property or method:
'Lib.AQ_SetStart'
**************************************************
Below code is used in dll
#include<windows.h>
#include"justDLL.h"
void AQ_SetStart(int a)
{
temp =a;
}
int AQ_GetStart()
{
return temp;
}
********************************
Below is JustDLL.h code
int temp;
extern"C"
__declspec(dllexport)
void AQ_SetStart(int);
extern"C"
__declspec(dllexport)
int AQ_GetStart();
***********************************
Below is TestComplete VBscript to call this dll and pass int values
Sub TestFunction
Dim MyStructID, A1, Def_DLL, Lib
MyStructID = DLL.DefineType("Mystruct", _
vt_i4, "First")
Set A1 = DLL.New("Mystruct")
A1.First = 1
Set Def_DLL = DLL.DefineDLL("DD1440A_DAQ_V_1.dll")
Set Lib = DLL.Load("C:\Users\20039895\Desktop\Test Complete_Tututorial\Custom_DLL\DD1440A_DAQ_V_1.dll")
call Def_DLL.DefineProc ("AQ_SetStart", VT_INT)
Lib.AQ_SetStart A1
End Sub
I'm writing a TestComplete script to pass arguments (int) to AQ_SetStart function in dll (dll is wrriten inV C++). Below is my C++ code for dll functions. While executing this TestComplete script, getting below error . And appreciate your early help.
Error
**************************************************
An exception occurred in the "Unit1" unit at line 38:
Microsoft VBScript runtime error
Object doesn't support this property or method: 'Lib.AQ_SetStart'An exception occurred in the "Unit1" unit at line 38:
Microsoft VBScript
runtime error
Object doesn't support this property or method:
'Lib.AQ_SetStart'
**************************************************
Below code is used in dll
#include<windows.h>
#include"justDLL.h"
void AQ_SetStart(int a)
{
temp =a;
}
int AQ_GetStart()
{
return temp;
}
********************************
Below is JustDLL.h code
int temp;
extern"C"
__declspec(dllexport)
void AQ_SetStart(int);
extern"C"
__declspec(dllexport)
int AQ_GetStart();
***********************************
Below is TestComplete VBscript to call this dll and pass int values
Sub TestFunction
Dim MyStructID, A1, Def_DLL, Lib
MyStructID = DLL.DefineType("Mystruct", _
vt_i4, "First")
Set A1 = DLL.New("Mystruct")
A1.First = 1
Set Def_DLL = DLL.DefineDLL("DD1440A_DAQ_V_1.dll")
Set Lib = DLL.Load("C:\Users\20039895\Desktop\Test Complete_Tututorial\Custom_DLL\DD1440A_DAQ_V_1.dll")
call Def_DLL.DefineProc ("AQ_SetStart", VT_INT)
Lib.AQ_SetStart A1
End Sub