Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • 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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

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