|
-
Oct 25th, 2022, 09:14 AM
#1
[RESOLVED] VB6 COM/Code Object Method Name ---> vTable Entry Number
Ok, I think this one is possible too, but I'm not sure how to get there.
I'm just talking about VB6 code objects (Classes, Forms, UCs, PropPages, & DataReports).
And I'm only talking about Public methods.
I'm staring at some code by Wqweto seen here. That shows how to use IDispatch to go from a method's name to its Dispatch_identifier. However, it doesn't show us how to get from there to the vTable entry.
Any tips on how to make this step would be greatly appreciated.
------------
Another idea I've got is to just get a complete list of Public methods of the object, in vTable order. From there, it'd be pretty easy. Maybe a function something like the following:
Code:
Option Explicit
Private Declare Function CLSIDFromString Lib "ole32" (ByVal lpsz As Any, pclsid As Any) As Long
Private Declare Function vbaCheckType Lib "msvbvm60" Alias "__vbaCheckType" (ByVal pObj As Any, ByRef pIID As Any) As Boolean
Public Function List_Of_Public_Vb6_Com_Methods(o As Object) As String()
If Not ObjectIsVb6ComCodeModule(o) Then
List_Of_Public_Vb6_Com_Methods = Split(vbNullString) ' 0 to -1 array.
Exit Function
End If
' Somehow call IDispatch::GetIDsOfNames and get the method list.
' And hopefully in vTable order.
' ??????????????
End Function
Private Function ObjectIsVb6ComCodeModule(o As IUnknown) As Boolean
Const AreYouABasicInstance As String = "{0B6C9465-D082-11CF-8B4F-00A0C90F2704}"
Dim aGUID(3&) As Long
CLSIDFromString StrPtr(AreYouABasicInstance), aGUID(0&)
ObjectIsVb6ComCodeModule = vbaCheckType(o, aGUID(0&))
End Function
Get/Let/Set methods (including Public variables) are a bit of a problem, but I don't really care about those. Maybe they can just be listed twice, without specifying whether they're Get or Let/Set.
Again, any tips on how to do this would be greatly appreciated.
------------
I'm trying my best to not be a "cargo culter". I'm just not sure where to get started with this, but I'll be searching while I'm waiting on tips.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|