Wednesday, January 18, 2012

How to debug ActiveX dll’s (VB6)

How to debug ActiveX dll’s (VB6)

1.) Get the method call, i.e. getDetails("1206", "1601001", "guya", "2", vTable, WriteAccess, RowCount)
2.) Open VB project, change project properties from “ActiveX DLL” to “Standard EXE” and start-up object to “Sub Main”
3.) Add in a Sub Main constructor, doing so in a *.bas (not *.class) module is fine

Public Sub Main()

' Note that switching from an ActiveX DLL to a Standard EXE may/will change the ' class module “Instancing” property from “Multiuse” to “Private” (error: “No
' creatable public component detected". To get back to the ActiveX DLL change the ' class module “Instancing” property back to “Multiuse”

Dim sError, vTable, WriteAccess, RowCount
‘ name of class that contains the function to invoke

Dim foo As New cReports

‘ invoke function
sError = foo.getDetails("1206", "1601001", "guya", "2", vTable, WriteAccess, RowCount)

‘F8 – away!

‘modal for a breakpoint
MsgBox Command$, vbOK, "Command Line params"

End Sub

No comments: