Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Can I use .net components from com programs?

1003


How to create an instance of the object in COM?

921


What are queued components?

990


how to call a dll as a COM dll?

1134


Which namespace do the classes, allowing you to support COM functionality, are located?

2530


What is dcom?

937


Define and explain about COM?

1031


What is the use of com component in .net?

953


What is the difference between aggregated and contained objects?

935


Once I have developed the com wrapper do I have to still register the com in registry?

1019


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?

908


Does .net replace com?

950


Can you explain what is dcom?

878


What is reference counting in com?

906


Is dcom dead?

994