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 |
When you call CoInitialize(NULL) function how it works internally.
how to call a dll as a COM dll?
What should QueryInterface functions do if requested object was not found?
What is the use of com component in .net?
What is the difference between aggregated and contained objects?
Explain transaction atomicity?
What is In-proc?
Suppose we have object b and aggregated object c (in- proc server), created by b. Can you access any interface of b from c? What?s the difference between aggregated and contained objects?
how do you know it is general dll or com dll
What is a moniker ?
what is mean by scintific,commercial and business applications? How they differ? Please answer me. Advance thanks.
What is IUnknown? What methods are provided by IUnknown?