Exposing struct as method parameter
-
I want to expose a user defined data type (struct) to clients using ATL. I also wanted this struct to be a parameter to one of my methods. Is there a way in which I could do this? SDE
If your class is
foo
and the structure ispublic
or accessible to the calling object:class foo { public: struct myStruct { int a; int b; } myStruct; void UseFooStruct(myStruct s); } class bar { public: void UseFooStruct(foo::myStruct s); }
-
If your class is
foo
and the structure ispublic
or accessible to the calling object:class foo { public: struct myStruct { int a; int b; } myStruct; void UseFooStruct(myStruct s); } class bar { public: void UseFooStruct(foo::myStruct s); }
-
I think I must have phrased it wrong. I know what you mean. But what I wanted is to expose the struct to one of my interfaces, then be able to pass the struct from Visual basic to My VC++ COM object. Is this possible? SDE
Yes. You can define a user defined structure (a
Type
) in VB which corresponds to your C++ structure. That way, you can pass the structure back and forth. Look in the MSDN on how to do this: Passing User-Defined Types to a DLL Procedure. Of course, yourType
declaration in VB must be equivalent to the C++ version.Ian Mariano - http://www.ian-space.com/
"We are all wave equations in the information matrix of the universe" - me