Ask a Question

Problem pausing scripts containing DLL structures

bduncan
Contributor

Problem pausing scripts containing DLL structures

If I run the following script there are no errors and the log is created with the appropriate values:



Sub Array_of_Structures

    MyStructID = DLL.DefineType( "MyStruct", _

                                                        vt_i4, "First", _

                                                        vt_i4, "Second", _

                                                        vt_i4, "Third" )



    Set A1 = DLL.New( "MyStruct", 10 )



    For i = 0 to 9

        A1( i ).First = i * 10

        A1( i ).Second = i * 10

        A1( i ).Third = i * 10



    Next



    For i = 0 to 9

        Log.Message "Value of  A1( " & i & " ).First = " & A1( i ).First

        Log.Message "Value of  A1( " & i & " ).Second = " & A1( i ).Second

        Log.Message "Value of  A1( " & i & " ).Third = " & A1( i ).Third



    Next



    Set A1 = nothing



End Sub





If however I put a Breakpoint or a Runner.Pause( ) statement anywhere in the Sub it pauses for a moment on the breakpoint but then errors out (see attached image).  Each error line references a different method.  Note the first line references WndStylesEx, the second line WndStyles, the third WndClass and so on.  This is running on 7.52.678.5



The second issue I have is with creating an array of pointers to structures.  I think I simply don't understand the proper procedure.



Sub Array_Of_Pointers

    MyStructID = DLL.DefineType( "MyStruct", _

                                                        vt_i4, "First", _

                                                        vt_i4, "Second", _

                                                        vt_i4, "Third" )

    

    'This line is from the help file and does not generate an error.  This is the only code sample

    'for creating an array of pointers.  All they say is that you can then fill the array with values

    Def_TmpStruct = DLL.DefineType( "TmpStruct", vt_byref OR MyStructID, "Value" ) 



    'I assume you create the array next.  This does not cause an error

    Set A3 = DLL.New( "TmpStruct", 10 )



     'If I try to fill the array with this statement:

     A3( i ).First = 10



    'I get an error message: Object doesn't support this property or method 'A3(...).First



     'If I try to fill the array with this statement:

     A3( i ).Value.First = 10



    'I get an error message: The element Value is not assigned

    

    'If however I make the following change

     Def_TmpStruct = DLL.DefineType( "TmpStruct", vt_byref OR vt_i4, "Value" )



     'I can fill this array and log it properly without any errors.

     ' Am I missing something??   



End Sub





Thanks

William


2 REPLIES 2
bduncan
Contributor

RE: Problem pausing scripts containing DLL structures

Disregard the comment about Breakpoint and Runner.Pause( ) not functioning.



It seems I am having the issue in all of my scripts since upgrading to the latest version.  I will investigate and see if I can correct the problem but if anyone has already seen this behaviour, any advice would be appriciated.





Thanks

William
bduncan
Contributor

RE: Problem pausing scripts containing DLL structures

Reinstalling Microsoft Script Debugging did not solve the problem so I fully uninstalled TestComplete and reinstalled it and everything is working fine again.







Thanks

William
cancel
Showing results for 
Search instead for 
Did you mean: