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

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

2 Answers   Cap Gemini, Honeywell,


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  


Write a JCL to copy only selected members from a partitioned data set to another partitioned data set. (Use: IEBCOPY)

1 Answers   Wipro,


Explain transaction atomicity?

1 Answers  


hi,I have applied for NIC test plz if any one have test paper pattrn plz send me on "mn_mayank38@yahoo.co.in"

1 Answers  


Explain queued components.

2 Answers  


Can you explain what is dcom?

0 Answers  


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

1 Answers  


What is the use of com component in .net?

0 Answers  


How does a DCOM component know where to instantiate itself?

1 Answers  


Differentiate normal DLL to COM DLL

7 Answers   Talisma,


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

0 Answers  


Categories