Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. COM
  4. Implement a new interface

Implement a new interface

Scheduled Pinned Locked Moved COM
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zubair_ahmed
    wrote on last edited by
    #1

    i want to expose all of my interfaces to a Vb application, but the vb application sees nothing except the default interface. thanx in advance Z.A -- modified at 2:11 Friday 24th February, 2006

    L M 2 Replies Last reply
    0
    • Z zubair_ahmed

      i want to expose all of my interfaces to a Vb application, but the vb application sees nothing except the default interface. thanx in advance Z.A -- modified at 2:11 Friday 24th February, 2006

      L Offline
      L Offline
      Lim Bio Liong
      wrote on last edited by
      #2

      Hello zubair_ahmed, Yes, COM objects will by default expose its "default" interface. However, you can DIM an object of another interface and cast the original COM object to this interface. Doing so is equivalent to performing QueryInterface(). Here is an example : '' Let's say TestObject supports its default interface '' plus TestInterface01 and TestInterface02. Set TestObjectObj = New TestObject '' Define objects of the 2 desired interfaces... Dim TestInterface01Ptr As TestInterface01 Dim TestInterface02Ptr As TestInterface02 '' Cast TestObjectObj to the desired interfaces. '' This action is equivalent to QueryInterface(). Set TestInterface01Ptr = TestObjectObj Set TestInterface02Ptr = TestObjectObj '' Use the interfaces' properties and methods as per normal... TestInterface01Ptr.strProperty = "Hello" TestInterface01Ptr.Method01 TestInterface02Ptr.longProperty = 101 TestInterface02Ptr.Method01 '' Set the interfaces to nothing is equivalent to Release()'ing '' the interface pointers. Set TestInterface01Ptr = nothing Set TestInterface02Ptr = nothing Best Regards, Bio.

      1 Reply Last reply
      0
      • Z zubair_ahmed

        i want to expose all of my interfaces to a Vb application, but the vb application sees nothing except the default interface. thanx in advance Z.A -- modified at 2:11 Friday 24th February, 2006

        M Offline
        M Offline
        mbue
        wrote on last edited by
        #3

        You have to add the IDispatch to all your Interfaces. For further informations see in your documentation how to implement an IDispatch-interface.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups