rfaricy
Well-known member
- Joined
- Feb 9, 2006
- Messages
- 46
- Programming Experience
- 5-10
I have a COM/ActiveX object which I am using in VB.NET for a project at work. I want to enhance its capabilities by wrapping it and its members in classes of my own so it is more .NET friendly. For instance, it uses and returns "Object" and "Variant" data types which I hate Casting into their proper native types every time I access a property or method, etc. (I highly prefer using Strict On to prevent issues, and so I always have code completion available; call me lazy, but it ends up being more work anyway.)
I've already done what I am looking for, sort-of, but it just seems so "messy" and the classes I've made aren't true "carbon copies" of what they are wrapping. What I am looking for, is a program or something that will take my object, and all of its properties, methods, events, etc (and all of the same of of its sub-classes') and generate VB.NET class files which basically model properties, event headers, methods, (and maybe even - though not required - pass them to and from the true object), so that I have total control over the data types which are passed back and forth.
I hope I am making sense. Basically this is an example of what I want:
My COM Object is called "GxUIProxyVB"
It has methods such as GetEntityProxy, LogOn and LogOff;
has properties such as IsLoggedOn [read-only; boolean] and ListEntityProxy [read-only; native type is 'GxListEntityProxy', a seperate class, but is returned as an Object]
I want to find a program to convert the above into the following:
Sorry for any syntax errors; I'm on a Mac so I just typed all that by hand. Yikes.
So is there a program that will convert a COM object to a skeleton class like this --- *EVEN IF* the subs are blank; as long as all the methods, properties, etc are there for me to start putting code into?
Worst-case, I can write my own program to do this but surely something already exists?
Thank you so much!
I've already done what I am looking for, sort-of, but it just seems so "messy" and the classes I've made aren't true "carbon copies" of what they are wrapping. What I am looking for, is a program or something that will take my object, and all of its properties, methods, events, etc (and all of the same of of its sub-classes') and generate VB.NET class files which basically model properties, event headers, methods, (and maybe even - though not required - pass them to and from the true object), so that I have total control over the data types which are passed back and forth.
I hope I am making sense. Basically this is an example of what I want:
My COM Object is called "GxUIProxyVB"
It has methods such as GetEntityProxy, LogOn and LogOff;
has properties such as IsLoggedOn [read-only; boolean] and ListEntityProxy [read-only; native type is 'GxListEntityProxy', a seperate class, but is returned as an Object]
I want to find a program to convert the above into the following:
VB.NET:
Public Class MyUIProxyClass
private m_UIProxy As GxUIProxyVB
Public Sub New
m_UIProxy = New GxUIProxyVB
End Sub
Public Sub LogOn(Username As String, Password As String)
m_UIProxy.LogOn(Username, Password)
End Sub
Public ReadOnly Property IsLoggedOn As Boolean
Get
Return m_UIProxy.IsLoggedOn
End Get
End Property
Public ReadOnly Property ListEntityProxy As MyListEntityProxyClass
Get
Return New MyListEntityProxyClass(m_UIProxy)
End Get
End Property
' etc ... more would be here
End Sub
Public Class MyListEntityProxyClass
Private m_Entities As GxListEntityProxy
Public Sub New(UIProxy As GxUIProxyVB)
m_Entities = UIProxy.ListEntityProxy
End Sub
Public ReadOnly Property Entities As GxListEntityProxy
Get
Return m_Entities
End Get
End Property
' and so on (more would be here)
End Class
Sorry for any syntax errors; I'm on a Mac so I just typed all that by hand. Yikes.
So is there a program that will convert a COM object to a skeleton class like this --- *EVEN IF* the subs are blank; as long as all the methods, properties, etc are there for me to start putting code into?
Worst-case, I can write my own program to do this but surely something already exists?
Thank you so much!