Solved

Passing structure in COM

Posted on 2002-06-02
7
218 Views
Last Modified: 2010-04-02
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
Comment
Question by:yonit
  • 3
  • 3
7 Comments
 
LVL 4

Expert Comment

by:Chase707
ID: 7049597
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
 

Accepted Solution

by:
vcppmfc earned 50 total points
ID: 7050350
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
 

Author Comment

by:yonit
ID: 7050387
What can be done for VB?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Expert Comment

by:Chase707
ID: 7050394
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
 

Author Comment

by:yonit
ID: 7050408
Sorry. I ment to give the points to Chase707. Can it be changed ???
0
 
LVL 4

Expert Comment

by:Chase707
ID: 7050420
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
 

Author Comment

by:yonit
ID: 7050428
I will
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now