How can would you create an instance of the object in COM

Answer Posted / balaji

We can use CreateInstance And CoCreateInstance to create an
instance of the object in COM.

HRESULT CreateInstance(void* pfnCreateInstance,REFIID riid,
void** ppvObj );

Parameters
pfnCreateInstance
[in] A pointer to a creator function.
riid
[in] The IID of the requested interface.
ppvObj
[out] A pointer to the interface pointer identified by
riid. If the object does not support this interface, ppvObj
is set to NULL.
Return Value

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define and explain about COM?

613


Can I use com components from .net programs?

603


Suppose we have object B and aggregated object C (in- proc server), created by B. Can you access any interface of B from C?

584


What is dcom?

535


How to create an instance of the object in COM?

575






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

2100


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?

505


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

657


Explain Futures of COM?

576


Can I use .net components from com programs?

611


What is the difference between aggregated and contained objects?

569


What are queued components?

585


Can you explain what is dcom?

543


What is the use of com component in .net?

593


Is dcom dead?

625