• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

Passing structure in COM

Hi,
Can I transfer my defined structure or a pointer to my structure as a COM paramter. I think that the user can recognize it from idl.
Thanks !
0
yonit
Asked:
yonit
  • 3
  • 3
1 Solution
 
Chase707Commented:
yes,

in the idl file:

typedef struct MY_STRUCT
{
    int mystuff;
} MY_STRUCT;
...
interface IMyInterface : IUknown
{
   HRESULT myMethod( [in] MY_STRUCT* pStruct);
}
...

then just implement it in your component as normal.

Chase707
0
 
vcppmfcCommented:
Hi Chase707

Its right , but then i think you cann't access this structure in scripting language like VB.OR this structure should be marshaled proferly.
0
 
yonitAuthor Commented:
What can be done for VB?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Chase707Commented:
In VB you can just define the structure using VB conventions before you call the method.  I do not know the VB language well, so I do not recall the exact syntax.

I think it's something like:
...
Type MY_STRUCT
   stuff as int
End Type
...

As long as your struct contains only Automation compatible types  (those defined in the VARIANT enum), then IDL will handle the details of marshalling your structures across processes.

0
 
yonitAuthor Commented:
Sorry. I ment to give the points to Chase707. Can it be changed ???
0
 
Chase707Commented:
I'm not sure about changing it, but you can create another question called 'points for Chase707'.  Then when I post an answer, you can then accept it.  It will end up costing you 50 more points though.

Chase707
0
 
yonitAuthor Commented:
I will
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now