Author | Topic: List Members of ActiveX or Automation Object | |
---|---|---|
Roger Donnay | List Members of ActiveX or Automation Object on Mon, 29 Dec 2008 14:57:52 -0700 I am looking for a way to get a list of members, ie properties, methods, events in an Xbase++ program. I need this info to be able to inspect ActiveX objects just like I can inspect Xbase parts objects with :classDescribe(). I know that I can use a third-party tool like Jace31Wizard.exe to dump all this to a PRG file, but then I would need to read all that info from the file into memory. This is probably what I will do if nobody can help. Does anyone know of a Windows API call that will give me a dump of info from an OCX? I can't find anything on MSDN that is easy to understand. | |
Clifford Wiernik | Re: List Members of ActiveX or Automation Object on Mon, 29 Dec 2008 22:32:48 -0600 Roger Donnay wrote: > I am looking for a way to get a list of members, ie properties, methods, > events in an Xbase++ program. > > I need this info to be able to inspect ActiveX objects just like I can > inspect Xbase parts objects with :classDescribe(). > > I know that I can use a third-party tool like Jace31Wizard.exe to dump all > this to a PRG file, but then I would need to read all that info from the > file into memory. > This is probably what I will do if nobody can help. > > Does anyone know of a Windows API call that will give me a dump of info from > an OCX? > > I can't find anything on MSDN that is easy to understand. > > > Roger, some of these may be helpful. http://www.codeproject.com/KB/combobox/Property_list_control.aspx http://www.devx.com/vb2themax/Tip/19226 I can't remember how to start a process in VB6, but if you run 'oleview.exe "C:/path/to/MyControl.ocx" > file.txt' that will send the output of oleview to a file. You might also check out the MemberInfo class - looks like you could do it programatically using it. Some info here (listed below) from 19226 link above posted by sanko at 3:06 PM on July 20, 2006 GetMemberType - Check whether an object exposes a property, method, event ' Returns a bit-coded value that specifies the type of ' an object's member (property, method, event) ' or zero if the member isn't there ' Object is the object which you want to work ' MemberName is the property, method or event name ' ' the return value is one of the following ' INVOKE_FUNC (method) ' INVOKE_PROPERTYGET (property get) ' INVOKE_PROPERTYPUT (property let) ' INVOKE_PROPERTYPUTREF (property Set) ' INVOKE_EVENTFUNC (event) ' INVOKE_CONST (const) ' 256 is added to INVOKE_FUNC if the method is a function ' Be sure that "TypeLib Information" type library (TlbInf32.tlb) ' is referenced in your VB project. Function GetMemberType(Object As Object, ByVal MemberName As String) As _ InvokeKinds Dim TLI As New TLIApplication Dim Interface As InterfaceInfo Dim Member As MemberInfo ' get the default interface of the object ' any error is returned to the called Set Interface = TLI.InterfaceInfoFromObject(Object) ' from now on, errors just return 0 On Error GoTo ErrorHandler ' search the property For Each Member In Interface.Members If StrComp(Member.Name, MemberName, vbTextCompare) = 0 Then ' add this bit to the result GetMemberType = GetMemberType Or Member.InvokeKind ' different behaviors, depending on member type Select Case Member.InvokeKind Case INVOKE_FUNC ' it's a method - add 256 if it has a return value If Member.ReturnType.VarType <> VT_VOID Then GetMemberType = 256 Or INVOKE_FUNC End If ' nothing else to do Exit For Case INVOKE_PROPERTYGET, INVOKE_PROPERTYPUT, _ INVOKE_PROPERTYPUTREF ' it's a property - the result is bit coded GetMemberType = GetMemberType Or Member.InvokeKind ' we can't exit until all the members have been parsed Case Else ' just return whatever value we found GetMemberType = Member.InvokeKind Exit For End Select End If Next Exit Function ErrorHandler: ' an error occurred, return 0 GetMemberType = 0 End Function | |
Roger Donnay | Re: List Members of ActiveX or Automation Object on Mon, 29 Dec 2008 22:02:31 -0700 Thanks Cliff, but I have come up with a solution. I used the Jace31Wizard.exe to dump all the CodeJock OCXs to separate files. Then I wrote a program that converts the files to a format that easier to read and removes all the junk. Finally, I wrote a set of functions that can now be used in any ActiveX program that will inspect Automation objects and show the contents of all ActiveX properties and events plus list all the methods. It does this by looking up the AutomationObject():interfaceName in the .DEF files and returning an array of member names. It works really slick and took much less time than I thought it would. I wrote this as part of XCodeJock, but I can see how it will work with any ActiveX product. This is a drill-up and drill-down object inspector that allows the programmer to walk thru a complex ActiveX project and better understand the design. It's gonna save me a lot of time working with CodeJock. "Clifford Wiernik" <cwsoft.nomorespam@charter.net> wrote in message news:7b54ab3e$188a8530$2048@news.alaska-software.com... > Roger Donnay wrote: >> I am looking for a way to get a list of members, ie properties, methods, >> events in an Xbase++ program. >> >> I need this info to be able to inspect ActiveX objects just like I can >> inspect Xbase parts objects with :classDescribe(). >> >> I know that I can use a third-party tool like Jace31Wizard.exe to dump >> all this to a PRG file, but then I would need to read all that info from >> the file into memory. >> This is probably what I will do if nobody can help. >> >> Does anyone know of a Windows API call that will give me a dump of info >> from an OCX? >> >> I can't find anything on MSDN that is easy to understand. >> >> >> > > Roger, some of these may be helpful. > > http://www.codeproject.com/KB/combobox/Property_list_control.aspx > http://www.devx.com/vb2themax/Tip/19226 > > > I can't remember how to start a process in VB6, but if you run > 'oleview.exe "C:/path/to/MyControl.ocx" > file.txt' that will send the > output of oleview to a file. > > You might also check out the MemberInfo class - looks like you could do it > programatically using it. Some info here (listed below) from 19226 link > above posted by sanko at 3:06 PM on July 20, 2006 > > > GetMemberType - Check whether an object exposes a property, method, event > > ' Returns a bit-coded value that specifies the type of > ' an object's member (property, method, event) > ' or zero if the member isn't there > > ' Object is the object which you want to work > ' MemberName is the property, method or event name > ' > ' the return value is one of the following > ' INVOKE_FUNC (method) > ' INVOKE_PROPERTYGET (property get) > ' INVOKE_PROPERTYPUT (property let) > ' INVOKE_PROPERTYPUTREF (property Set) > ' INVOKE_EVENTFUNC (event) > ' INVOKE_CONST (const) > ' 256 is added to INVOKE_FUNC if the method is a function > > ' Be sure that "TypeLib Information" type library (TlbInf32.tlb) > ' is referenced in your VB project. > > Function GetMemberType(Object As Object, ByVal MemberName As String) As _ > InvokeKinds > Dim TLI As New TLIApplication > Dim Interface As InterfaceInfo > Dim Member As MemberInfo > > ' get the default interface of the object > ' any error is returned to the called > Set Interface = TLI.InterfaceInfoFromObject(Object) > > ' from now on, errors just return 0 > On Error GoTo ErrorHandler > > ' search the property > For Each Member In Interface.Members > If StrComp(Member.Name, MemberName, vbTextCompare) = 0 Then > ' add this bit to the result > GetMemberType = GetMemberType Or Member.InvokeKind > > ' different behaviors, depending on member type > Select Case Member.InvokeKind > Case INVOKE_FUNC > ' it's a method - add 256 if it has a return value > If Member.ReturnType.VarType <> VT_VOID Then > GetMemberType = 256 Or INVOKE_FUNC > End If > ' nothing else to do > Exit For > Case INVOKE_PROPERTYGET, INVOKE_PROPERTYPUT, _ > INVOKE_PROPERTYPUTREF > ' it's a property - the result is bit coded > GetMemberType = GetMemberType Or Member.InvokeKind > ' we can't exit until all the members have been parsed > Case Else > ' just return whatever value we found > GetMemberType = Member.InvokeKind > Exit For > End Select > End If > Next > > Exit Function > > ErrorHandler: > ' an error occurred, return 0 > GetMemberType = 0 > End Function > > | |
Reinthaler Rudolf | Re: List Members of ActiveX or Automation Object on Fri, 16 Jan 2009 09:15:31 +0100 Hello Roger, it's great to have this in eXPress++ because for me the greatest problem working with ActiveX is the clear laid out infos about all properties and events of an object. Is this available for all eXpress++ users or only for XCodeJock ? regards Rudolf "Roger Donnay" <rogerdonnay@donnay-software.com> schrieb im Newsbeitrag news:2198c80e$367c9f8d$2018@news.alaska-software.com... > Thanks Cliff, but I have come up with a solution. > > I used the Jace31Wizard.exe to dump all the CodeJock OCXs to separate > files. > Then I wrote a program that converts the files to a format that easier to > read and removes all the junk. > Finally, I wrote a set of functions that can now be used in any ActiveX > program that will inspect Automation objects and show the contents of all > ActiveX properties and events plus list all the methods. It does this by > looking up the AutomationObject():interfaceName in the .DEF files and > returning an array of member names. > > It works really slick and took much less time than I thought it would. I > wrote this as part of XCodeJock, but I can see how it will work with any > ActiveX product. > > This is a drill-up and drill-down object inspector that allows the > programmer to walk thru a complex ActiveX project and better understand > the design. > It's gonna save me a lot of time working with CodeJock. > > "Clifford Wiernik" <cwsoft.nomorespam@charter.net> wrote in message > news:7b54ab3e$188a8530$2048@news.alaska-software.com... >> Roger Donnay wrote: >>> I am looking for a way to get a list of members, ie properties, methods, >>> events in an Xbase++ program. >>> >>> I need this info to be able to inspect ActiveX objects just like I can >>> inspect Xbase parts objects with :classDescribe(). >>> >>> I know that I can use a third-party tool like Jace31Wizard.exe to dump >>> all this to a PRG file, but then I would need to read all that info from >>> the file into memory. >>> This is probably what I will do if nobody can help. >>> >>> Does anyone know of a Windows API call that will give me a dump of info >>> from an OCX? >>> >>> I can't find anything on MSDN that is easy to understand. >>> >>> >>> >> >> Roger, some of these may be helpful. >> >> http://www.codeproject.com/KB/combobox/Property_list_control.aspx >> http://www.devx.com/vb2themax/Tip/19226 >> >> >> I can't remember how to start a process in VB6, but if you run >> 'oleview.exe "C:/path/to/MyControl.ocx" > file.txt' that will send the >> output of oleview to a file. >> >> You might also check out the MemberInfo class - looks like you could do >> it programatically using it. Some info here (listed below) from 19226 >> link above posted by sanko at 3:06 PM on July 20, 2006 >> >> >> GetMemberType - Check whether an object exposes a property, method, event >> >> ' Returns a bit-coded value that specifies the type of >> ' an object's member (property, method, event) >> ' or zero if the member isn't there >> >> ' Object is the object which you want to work >> ' MemberName is the property, method or event name >> ' >> ' the return value is one of the following >> ' INVOKE_FUNC (method) >> ' INVOKE_PROPERTYGET (property get) >> ' INVOKE_PROPERTYPUT (property let) >> ' INVOKE_PROPERTYPUTREF (property Set) >> ' INVOKE_EVENTFUNC (event) >> ' INVOKE_CONST (const) >> ' 256 is added to INVOKE_FUNC if the method is a function >> >> ' Be sure that "TypeLib Information" type library (TlbInf32.tlb) >> ' is referenced in your VB project. >> >> Function GetMemberType(Object As Object, ByVal MemberName As String) As _ >> InvokeKinds >> Dim TLI As New TLIApplication >> Dim Interface As InterfaceInfo >> Dim Member As MemberInfo >> >> ' get the default interface of the object >> ' any error is returned to the called >> Set Interface = TLI.InterfaceInfoFromObject(Object) >> >> ' from now on, errors just return 0 >> On Error GoTo ErrorHandler >> >> ' search the property >> For Each Member In Interface.Members >> If StrComp(Member.Name, MemberName, vbTextCompare) = 0 Then >> ' add this bit to the result >> GetMemberType = GetMemberType Or Member.InvokeKind >> >> ' different behaviors, depending on member type >> Select Case Member.InvokeKind >> Case INVOKE_FUNC >> ' it's a method - add 256 if it has a return value >> If Member.ReturnType.VarType <> VT_VOID Then >> GetMemberType = 256 Or INVOKE_FUNC >> End If >> ' nothing else to do >> Exit For >> Case INVOKE_PROPERTYGET, INVOKE_PROPERTYPUT, _ >> INVOKE_PROPERTYPUTREF >> ' it's a property - the result is bit coded >> GetMemberType = GetMemberType Or Member.InvokeKind >> ' we can't exit until all the members have been >> parsed >> Case Else >> ' just return whatever value we found >> GetMemberType = Member.InvokeKind >> Exit For >> End Select >> End If >> Next >> >> Exit Function >> >> ErrorHandler: >> ' an error occurred, return 0 >> GetMemberType = 0 >> End Function >> >> > > |