Results 1 to 4 of 4

Thread: Implementing Interfaces

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2002
    Location
    Amsterdam
    Posts
    51

    Implementing Interfaces

    In a lot of articles I come across the term "implement the interface bladiebladiebla". When reading this I always feel like reaching the great big VB-Wall (looking over it, you will see all the things that can be done with C++).

    I am a real VB-programmer, saying I am not really interested in threads and marshalling and other plumbing-work. But VB always fences me off. Setting references and making API-calls is not a real problem. But what do you do when there is a requirement like "implement the IOLECommandTarget" interface?

    Those who know C++, please let me know how to cross barrier in a general way.

  2. #2
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    you can always make a dll (or have one made) to do specific tasks and use the control with your VB app.

    Guess you prolly allready know that tho...

  3. #3
    Addicted Member
    Join Date
    Apr 2000
    Location
    England
    Posts
    246
    Yes you can for some things.

    for example the ForEach Numueration can be passed from a collection, where your passing the interface back.

    You can assign Properties to your methods and functions.

    for example (you can tell VB that that function you wrote is the BackColor Interface)

    theres something like 92 different interfaces and VB implements something like 18 of them without even asking you.

    It depends on what the interface is and what it does.

    writting custom interfaces i think is impossible. (but you can steal them, eg. Stealing the newEnum interface from a collection in your object and passing back that interface to the calling program, and assign the procedure ID of -4 to that method, therefore implementing an unsupported interface in VB)

    A usercontrol provides more choices than a standard object (which VB can let you code just aboutbox and refresh interfaces)

    a user control has 19 avaible interfaces (not including hidden ones)
    Some Days, i just get this feeling that i'm helping to write dozens of Viruses...

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2002
    Location
    Amsterdam
    Posts
    51
    Well, thanks for the reactions. I have done some further reading myself.

    I discovered the OLE viewer, which exposes GUIDs for interfaces, and also documents in which the dll in which it is implemented is mentioned. The interface I was interested in (IOLECommandTarget) resides in actxprxy.dll which cannot be set as a reference to a VB project.

    Apparently you can import interfaces in C++ by name. In VB you can only set references to files that support VB. Datatypes have to be matched to the set supported by VB. So you have to create a type library which converts all the datatypes to VB-friendly ones.

    Conclusion - implementing non-VB-friendly interfaces is a very complex thing. Perhaps writing the component in C++ is easier.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width