bduncan
15 years agoContributor
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
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