Click here to Skip to main content
15,912,329 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questioncolor new Pin
sidkraft14-Jun-06 7:27
sidkraft14-Jun-06 7:27 
AnswerRe: color new Pin
Laxman Auti14-Jun-06 18:38
Laxman Auti14-Jun-06 18:38 
QuestionCComSafeArray Pin
pierre_ribery14-Jun-06 7:16
pierre_ribery14-Jun-06 7:16 
AnswerRe: CComSafeArray Pin
JonEngle14-Jun-06 9:18
JonEngle14-Jun-06 9:18 
GeneralRe: CComSafeArray Pin
pierre_ribery14-Jun-06 10:28
pierre_ribery14-Jun-06 10:28 
GeneralRe: CComSafeArray Pin
JonEngle14-Jun-06 10:59
JonEngle14-Jun-06 10:59 
GeneralRe: CComSafeArray Pin
pierre_ribery14-Jun-06 11:13
pierre_ribery14-Jun-06 11:13 
GeneralRe: CComSafeArray Pin
JonEngle14-Jun-06 11:50
JonEngle14-Jun-06 11:50 
Well, it's extremely uncommon to have a structure with uniform data types. Most structs are more like

struct
{
int value;
float fvalue;
short somethingElse;
etc., etc.
}

Now, for your case, I'd do one of two approaches. The big question is do you have to support scripting environments?

Option 1) Using the interface

Define the structure in IDL. This looks pretty much identical to you C structure definition.

Define a method that returns these:

For instance, in your IDL

struct MY_STRUCT{
long a;
long b;
long c;
};
//as a method on your COM object
[propget, id(1)] HRESULT Item([in[ Index,[out,retval] struct MyDataType* blah);

And implement from there.

Option 2) Using a big safearray

Create a safearray of variants (one for each structure), then each variant is a safearray of VT_I4. It's up to your client to know what the order of each value means, which means that this approach is fairly brittle.


GeneralRe: CComSafeArray Pin
pierre_ribery14-Jun-06 22:16
pierre_ribery14-Jun-06 22:16 
GeneralRe: CComSafeArray Pin
pierre_ribery3-Jul-06 1:29
pierre_ribery3-Jul-06 1:29 
QuestionDirectShow BITMAP Pin
TBA_SST14-Jun-06 7:05
TBA_SST14-Jun-06 7:05 
AnswerRe: DirectShow BITMAP Pin
James R. Twine14-Jun-06 7:11
James R. Twine14-Jun-06 7:11 
AnswerRe: DirectShow BITMAP Pin
Justin Tay14-Jun-06 8:31
Justin Tay14-Jun-06 8:31 
QuestionSend xy plot by email Pin
BambooMoon14-Jun-06 6:30
BambooMoon14-Jun-06 6:30 
AnswerRe: Send xy plot by email Pin
Chris Losinger14-Jun-06 6:58
professionalChris Losinger14-Jun-06 6:58 
AnswerRe: Send xy plot by email Pin
James R. Twine14-Jun-06 7:07
James R. Twine14-Jun-06 7:07 
QuestionRe: Send xy plot by email Pin
Jun Du14-Jun-06 7:41
Jun Du14-Jun-06 7:41 
QuestionWriteConsole() pointer problem Pin
CoffeeAddict1914-Jun-06 6:27
CoffeeAddict1914-Jun-06 6:27 
QuestionRe: WriteConsole() pointer problem Pin
David Crow14-Jun-06 6:41
David Crow14-Jun-06 6:41 
AnswerRe: WriteConsole() pointer problem [modified] Pin
James R. Twine14-Jun-06 7:03
James R. Twine14-Jun-06 7:03 
GeneralRe: WriteConsole() pointer problem Pin
CoffeeAddict1914-Jun-06 9:25
CoffeeAddict1914-Jun-06 9:25 
Questionparent dialog accessing from a child dialog Pin
erfi14-Jun-06 6:14
erfi14-Jun-06 6:14 
AnswerRe: parent dialog accessing from a child dialog Pin
Milton Karimbekallil14-Jun-06 6:27
Milton Karimbekallil14-Jun-06 6:27 
GeneralRe: parent dialog accessing from a child dialog Pin
erfi14-Jun-06 6:58
erfi14-Jun-06 6:58 
QuestionRe: parent dialog accessing from a child dialog Pin
David Crow14-Jun-06 6:40
David Crow14-Jun-06 6:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.