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
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. How to pass Structures/Types as parameters in COM DLL function?

How to pass Structures/Types as parameters in COM DLL function?

Scheduled Pinned Locked Moved ATL / WTL / STL
c++comhelptutorial
2 Posts 2 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.
  • K Offline
    K Offline
    karnav zaveri
    wrote on last edited by
    #1

    Hi all, Does aNy body know how we can pass strucutres ( types in VB ) as parameters of function defined in COM DLL interface ? For e.g. I have one interface called IDatabase and i want to add method like "HRESULT SetData([in]USER userData)". In this case the DLL is compiled successfully, but when it is used in the Visual Basic, it gives error "user defined object can not be passed by value". The DLL should be used in both VB and VC++ client applicaitons. Karnav Zaveri

    S 1 Reply Last reply
    0
    • K karnav zaveri

      Hi all, Does aNy body know how we can pass strucutres ( types in VB ) as parameters of function defined in COM DLL interface ? For e.g. I have one interface called IDatabase and i want to add method like "HRESULT SetData([in]USER userData)". In this case the DLL is compiled successfully, but when it is used in the Visual Basic, it gives error "user defined object can not be passed by value". The DLL should be used in both VB and VC++ client applicaitons. Karnav Zaveri

      S Offline
      S Offline
      Starick
      wrote on last edited by
      #2

      It's not a simple task to pass structures in COM/DCOM. 1. A structure must be of the type VT_RECORD. 2. All the structure's fields must be of an automation-compatible type. 3. The structure must be described in a TLB. 4. The structure must have a GUID (assigned in the IDL file). 5. A special structure-oriented interface IRecordInfo must be used to manipulate structures (IRecordInfo::RecordCreate(), IRecordInfo::RecordDestroy(), etc.).

      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