How to Use structs in COM interfaces when Automation
compatibility is not an issue?






How to Use structs in COM interfaces when Automation compatibility is not an issue?..

Answer / krishna akkulu

Structs, also known as User Defined Types (UDTs), can be
used in Automation- compatible interfaces
An Automation- compatible struct may contain only primitive
Automation types as its members.

Nesting structs is not allowed, but VARIANT is allowed thus
enabling nested structs (you can store a struct in a
VARIANT).

In order for a struct to be usable for Automation-
compatible interfaces, the struct must be described in a
type library and it must be declared with its own GUID:

[uuid(21602F40-CC62-11d4-AA2B-00A0CC39CFE0)]
struct MyStruct
{
[helpstring("A long value")]
long nLongValue;

[helpstring("A string")]
BSTR bstrStringValue;
};

// Later in the IDL file
[uuid(...), version(...), helpstring(...)]
library MyLib
{
...
struct MyStruct;
};
For more info see : http://vcfaq.mvps.org/com/4.htm

Is This Answer Correct ?    0 Yes 3 No

Post New Answer




More COM DCOM Interview Questions

What is IUnknown? What methods are provided by IUnknown?

3 Answers   IBM,


Which tool is used to configure the port range and protocols for DCOM communications?

1 Answers  


where can i use pmcmd commands of informatica

1 Answers  


Futures of COM

3 Answers   MIT,


what is mean by scintific,commercial and business applications? How they differ? Please answer me. Advance thanks.

0 Answers   Excel,






how you call a dll as a COM dll.

2 Answers  


Define and explain COM?

8 Answers   Microsoft,


What is the difference, if any, between OLE and COM?

3 Answers  


can a COM interface be implemented by more than one COM class in the same COM component?

2 Answers   Cap Gemini, Honeywell,


Explain transaction atomicity?

1 Answers  


What kind of components can be used as DCOM servers?

1 Answers  


How do you make a NET component talk to a COM component?

3 Answers   TCS,






Categories