|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to make a DLL usable from VB6I have been trying to build a DLL in vb2008, that can be called from a VB6 application.. So far I have got the DLL to be registered on the VB6 machine ok, but it can't see any of my interfaces/functions. So I figure my class is configured ok, but the functions are not.. (I have the COMM Class and COM Visible set to true for the properties of the class). I also have under the project/properties.compile option of Register for COM interop set as well... Can anybody give me a tip on what is wrong with this code.. Thanks... <ComClass(TestClass.ClassId, TestClass.InterfaceId, TestClass.EventsId)> _ Public Class TestClass #Region "COM GUIDs" ' These GUIDs provide the COM identity for this class ' and its COM interfaces. If you change them, existing ' clients will no longer be able to access the class. Public Const ClassId As String = "d41b9efd-ce16-48df-bab4-16352d47b669" Public Const InterfaceId As String = "bd2b42e6-4e8b-4195-82e6-c3dd7c6b4bbb" Public Const EventsId As String = "1f0dbdf5-5509-4e4f-aaf6-631572881186" #End Region ' A creatable COM class must have a Public Sub New() ' with no parameters, otherwise, the class will not be ' registered in the COM registry and cannot be created ' via CreateObject. Public Sub New() MyBase.New() End Sub Public Shared Function GetValue(ByVal intShelfID As Integer) As Integer GetValue= 99 Return GetValue End Function Public Shared Function ValueID() Return 1 End Function End Class Am 10.06.2010 15:28, schrieb AussieRules:
Show quoteHide quote > Hi, I only see shared members in this class. Therefore there is nothing to expose.> I have been trying to build a DLL in vb2008, that can be called from a VB6 > application.. So far I have got the DLL to be registered on the VB6 machine > ok, but it can't see any of my interfaces/functions. > > So I figure my class is configured ok, but the functions are not.. (I have > the COMM Class and COM Visible set to true for the properties of the class). > I also have under the project/properties.compile option of Register for COM > interop set as well... > > Can anybody give me a tip on what is wrong with this code.. > > Thanks... > > <ComClass(TestClass.ClassId, TestClass.InterfaceId, TestClass.EventsId)> _ > Public Class TestClass > > #Region "COM GUIDs" > ' These GUIDs provide the COM identity for this class > ' and its COM interfaces. If you change them, existing > ' clients will no longer be able to access the class. > Public Const ClassId As String = "d41b9efd-ce16-48df-bab4-16352d47b669" > Public Const InterfaceId As String = > "bd2b42e6-4e8b-4195-82e6-c3dd7c6b4bbb" > Public Const EventsId As String = "1f0dbdf5-5509-4e4f-aaf6-631572881186" > #End Region > > ' A creatable COM class must have a Public Sub New() > ' with no parameters, otherwise, the class will not be > ' registered in the COM registry and cannot be created > ' via CreateObject. > Public Sub New() > MyBase.New() > End Sub > Public Shared Function GetValue(ByVal intShelfID As Integer) As Integer > > GetValue= 99 > Return GetValue > > End Function > > Public Shared Function ValueID() > Return 1 > > End Function > End Class "...static methods [...] are not exposed to COM clients". Source: http://msdn.microsoft.com/en-us/library/7fcfby2t%28VS.90%29.aspx -- Armin Hi Armin,
Thanks for your reply... I have tried to find the proper way to declare my function so that they are exposed, but no luck... Could I ask for your assistance and have you just show me the correct code to expose my functions... Thanks heaps for this.. Thanks Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:uxaPvtMCLHA.5848@TK2MSFTNGP06.phx.gbl... > Am 10.06.2010 15:28, schrieb AussieRules: >> Hi, >> I have been trying to build a DLL in vb2008, that can be called from a >> VB6 >> application.. So far I have got the DLL to be registered on the VB6 >> machine >> ok, but it can't see any of my interfaces/functions. >> >> So I figure my class is configured ok, but the functions are not.. (I >> have >> the COMM Class and COM Visible set to true for the properties of the >> class). >> I also have under the project/properties.compile option of Register for >> COM >> interop set as well... >> >> Can anybody give me a tip on what is wrong with this code.. >> >> Thanks... >> >> <ComClass(TestClass.ClassId, TestClass.InterfaceId, TestClass.EventsId)> >> _ >> Public Class TestClass >> >> #Region "COM GUIDs" >> ' These GUIDs provide the COM identity for this class >> ' and its COM interfaces. If you change them, existing >> ' clients will no longer be able to access the class. >> Public Const ClassId As String = >> "d41b9efd-ce16-48df-bab4-16352d47b669" >> Public Const InterfaceId As String = >> "bd2b42e6-4e8b-4195-82e6-c3dd7c6b4bbb" >> Public Const EventsId As String = >> "1f0dbdf5-5509-4e4f-aaf6-631572881186" >> #End Region >> >> ' A creatable COM class must have a Public Sub New() >> ' with no parameters, otherwise, the class will not be >> ' registered in the COM registry and cannot be created >> ' via CreateObject. >> Public Sub New() >> MyBase.New() >> End Sub >> Public Shared Function GetValue(ByVal intShelfID As Integer) As >> Integer >> >> GetValue= 99 >> Return GetValue >> >> End Function >> >> Public Shared Function ValueID() >> Return 1 >> >> End Function >> End Class > > I only see shared members in this class. Therefore there is nothing to > expose. > > "...static methods [...] are not exposed to COM clients". Source: > http://msdn.microsoft.com/en-us/library/7fcfby2t%28VS.90%29.aspx > > -- > Armin Am 14.06.2010 17:07, schrieb AussieRules:
> Hi Armin, Did you understand why they are not exposed?> > Thanks for your reply... I have tried to find the proper way to declare my > function so that they are exposed, but no luck... > > Could I ask for your assistance and have you just show me the correct code > to expose my functions... > > Thanks heaps for this.. -- Armin Hi,
No I don't. I have read the article, but its above my head on what it all means... I would have thought that 'public shared' would have at least meant it was exposed to outside world, but that seems not the case... I just need to be pointed in the right direction and shown how to do this, then it will probably click for me... I am under the pump to get this done in the next day or so, so thanks for your assitance on this one.. Thanks.. Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:%23EnvcW9CLHA.4400@TK2MSFTNGP05.phx.gbl... > Am 14.06.2010 17:07, schrieb AussieRules: >> Hi Armin, >> >> Thanks for your reply... I have tried to find the proper way to declare >> my >> function so that they are exposed, but no luck... >> >> Could I ask for your assistance and have you just show me the correct >> code >> to expose my functions... >> >> Thanks heaps for this.. > > Did you understand why they are not exposed? > > > -- > Armin Am 15.06.2010 00:58, schrieb AussieRules:
> Hi, Don't make the methods Shared. Make them instance members. (remove "Shared").> > No I don't. I have read the article, but its above my head on what it all > means... > > I would have thought that 'public shared' would have at least meant it was > exposed to outside world, but that seems not the case... > > I just need to be pointed in the right direction and shown how to do this, > then it will probably click for me... > > I am under the pump to get this done in the next day or so, so thanks for > your assitance on this one.. -- Armin
Reading from LDAP searchresults
what font it is ? Referencing to a specific instance of a program Disable loading of images in WebBrowser control Need assistance with Detailsview and passing values to a textbox Using several bindingSource on the same datatable. create eventhandler Excel Chart as Image (no file) INotifyPropertyChanged issue Icon Chalange |
|||||||||||||||||||||||