Declare shared function in com (vc++)
-
How should declare function in COM (vc++) in order to be seen as shared in vb (no instance object needed for function call)? thx
-
How should declare function in COM (vc++) in order to be seen as shared in vb (no instance object needed for function call)? thx
As far as I know you can't. COM is all about creating object then calling functions those object provide (via interfaces). You could call a VB Shared method and within that method create a new COM object, call its function then delete it - all within the Shared VB. On the other hand perhaps using a Shared may not be the only way to do what you want.
-
As far as I know you can't. COM is all about creating object then calling functions those object provide (via interfaces). You could call a VB Shared method and within that method create a new COM object, call its function then delete it - all within the Shared VB. On the other hand perhaps using a Shared may not be the only way to do what you want.
Shared vb function than creates an instance of my class, calls function (static one) then delete that object is a good solution, but not a perfect one. Was thinking perhaps there is a keyword that will expose function the way I want If you can tell me what's the other way arround please let me know thx
-
Shared vb function than creates an instance of my class, calls function (static one) then delete that object is a good solution, but not a perfect one. Was thinking perhaps there is a keyword that will expose function the way I want If you can tell me what's the other way arround please let me know thx
Sorry, I haven't got another way exactly. What I meant was that when using VB you tend to get used to the things VB lets you do and use - such as using Shared. With COM you have to think more in terms of objects and interfaces and so you tend to design solutions around them.
-
Sorry, I haven't got another way exactly. What I meant was that when using VB you tend to get used to the things VB lets you do and use - such as using Shared. With COM you have to think more in terms of objects and interfaces and so you tend to design solutions around them.
Static functions from c++ are equivalent to shared from VB; was thinking there is a way to just expose this static functions; if there isn't will just have to call code in vb common way, using object thx
-
How should declare function in COM (vc++) in order to be seen as shared in vb (no instance object needed for function call)? thx
COM exposes interfaces and not methods. According to your requirement, you want to expose a static method. That is not COM.
«_Superman_»
-
How should declare function in COM (vc++) in order to be seen as shared in vb (no instance object needed for function call)? thx
Pop Cristian wrote:
no instance object needed for function call
I'm not sure about your requirement, but C++ dll,with exposed methods can be used in VB. As far as COM is concerned, it talks thorugh interfaces(so you need object) only.
-
How should declare function in COM (vc++) in order to be seen as shared in vb (no instance object needed for function call)? thx
Hi, I guess you need to be more clear with your requirements. else you drop in such situation. you could full fill your requirement by exposing c++ static methods. what makes to do this thru COM. COM is full if dynamic bindings. and VB shared stuff is full of static things that are decided at compilation.....
^-^ @|@ - redCat
-
Hi, I guess you need to be more clear with your requirements. else you drop in such situation. you could full fill your requirement by exposing c++ static methods. what makes to do this thru COM. COM is full if dynamic bindings. and VB shared stuff is full of static things that are decided at compilation.....
^-^ @|@ - redCat
I have lots of structures/classes in my library, so I need to be COM; there is no specific requirement, all I needed was just a fancy way of exposing / calling a static vc function; I have now in c code, CMyClass::DoThis(param1, param2), so no need to create new object in c for this; I'll just create a new object in vb, call my function and discard object afterwards Was thinking in vb I could've have CMyClass.DoThis(param1, param2) instead of dim c as new CMyClass c.DoThis(param1, paramt) thx