I am getting the following error when trying to use a custom DLL function from TC. Error:
An exception occurred in the "Unit1" unit at line 78:
An exception occurred: 0xC0000005; class: ; description: ''
Here is the code I am trying to execute. The error occurs on the last line:
Set DefDLL = DLL.DefineDLL("MyDLL")
Call DefDLL.DefineProc("MyDLLOpenConnection", VT_I4, VT_I4)
Set Lib = DLL.Load("c:\MyApp\system\MyDLL.dll", "MyDLL")
Log.Message "CurrHwnd:" & CurrWindHwnd
I have been using this custom DLL from Rational Robot for years. Here is how I define the function from withint Robot:
Declare Function MyDLLOpenConnection Lib "c:\MyApp\system\MyDLL.dll" (ByVal hWnd as Long) as Long
Re: DLL Error
As an additional test to make sure DLL's were working I added the following function in my test and it works fine.
Set DefDLL = DLL.DefineDLL("user32")
Set Lib = DLL.Load("C:\Windows\System32\user32.dll")
Call DefDLL.DefineProc("GetWindowTextA", VT_UI4, VT_LPSTR, VT_I4, VT_I4)
Call DefDLL.DefineAlias("GetWindowText", "GetWindowTextA")
hndl = Sys.Process("Notepad").Window("Notepad").Handle
Set winText = DLL.New("LPSTR", 256)
Call Lib.GetWindowText(hndl, winText, 20)
Set winText2 = DLL.New("LPSTR", 256)
Call Lib.GetWindowTextA(hndl, winText2, 20)
Re: DLL Error
What version of the product are you using? There was a known problem in TestComplete 8.60 related to the DLL access.
I recommend that you upgrade your product. TestComplete 8.70 is available for downloading from our web site.
Let me know if you face the issue in the current version of the product.