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

Answers were Sorted based on User's Feedback



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

Answer / chandrasekharreddy siddamreddy

To create the instance of COM componet use the following
WIN32 APIs
To access the component that was there in local system use
following API
CoCreateInstance(clsid,NULL(used for
aggregation),CLSCTX_ALL,Interface_GUID,(void**)
&pRequestedInterface );

To access the COM componet remotely use the following API
CoCreateInstanceEx
(CLSID,NULL,CLSCTX_ALL,COSERVERINFO,Interface_GUID,MULTI_QI*
);

Is This Answer Correct ?    3 Yes 0 No

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

Answer / 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

More COM DCOM Interview Questions

how you call a dll as a COM dll.

2 Answers  


What is IUnknown? What methods are provided by IUnknown?

3 Answers   IBM,


What should QueryInterface functions do if requested object was not found?

1 Answers  


What is a moniker ?

3 Answers  


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

3 Answers   TCS,






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

0 Answers  


What are the purposes of AddRef, Release and QueryInterface functions

2 Answers  


What happens when client calls CoCreateInstance?

2 Answers   Cap Gemini,


What is dcom?

0 Answers  


what is far pointer and what are the use of far poiter in com/dcom ?????

2 Answers   HCL,


Explain transaction atomicity?

1 Answers  


Can I use .net components from com programs?

0 Answers  


Categories