COM DCOM

  Home  Computer Programming  COM DCOM


“DCOM COM frequently Asked Questions by expert members with experience in COM DCOM. So get preparation for the DCOM COM job interview”



25 COM DCOM Questions And Answers

2⟩ What are queued components?

Queued Components, a key feature of COM+ and based on

Microsoft Message Queuing Services (MSMQ), provides an easy

way to invoke and execute components asynchronously.

Processing can occur without regard to the availability or

accessibility of either the sender or receiver. A home

shopping network is an example of the type of application

that might benefit from asynchronous processing. In this

asynchronous, disconnected scenario where viewers phone in

to several operators, orders are taken en masse and are

then queued for later retrieval and processing by the

server.

 143 views

5⟩ How to create an instance of the object in COM?

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*

);

 152 views

7⟩ What happens when client calls CoCreateInstance?

- Reads RootClassesProgId for the matching ProgID

- Reads RootClassesProgId for the matching CLSID. The

CLSID is read from the above step.

- From the CLSID key, the server type and image filename is

known.

- Depending upon the server type, it starts the server.

- Calls CoGetClassObject function to get a handle to the

factory object.

- Then calls createinstance on the factory interface to get

the pointer to the derived object.

 157 views

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

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;

};

 176 views

13⟩ Explain Futures of COM?

1. Defines a binary standard for component interoperability

2. Is programming language-independent

3. Is provided on multiple platforms (Microsoft® Windows®,

4. Microsoft Windows NT™, Apple® Macintosh®, UNIX®)

5. Provides for robust evolution of component-based

applications and systems

6. Is extensible

 161 views

14⟩ What are the purposes of AddRef, Release and QueryInterface functions?

Query Interface method is used to get the pointer to the

interface specified in one of the parameters of this

method. Client then uses this pointer to call the method of

the component.

AddRef and Release are used to increase and decrease the

count of the instance of component loaded in memory

respectively. when the count reaches zero the component is

unloaded.

 179 views

18⟩ Differentiate normal DLL to COM DLL?

COM Dll exposes Interface on the contrary to normal DLL

that exports functions. Clients create the pointer to

COMDLL's interface to call the methods defined by the

component that implements the interface.

That results in isolation of implementation and definition

of method in the interface. Client doesnt need to relink or

recompile the code if method in the com dll changes as far

as the definition of the interface remains same.

 152 views

19⟩ How do you know it is general dll or com dll?

Open the dll in dependency walker application

(depends.exe). If the dll is having following functions

DLLRegisterServer

DLLUnRegisterServer

DLLCanUnloadNow

DLLGetClassObject

It is a COM DLL otherwise it is not.

 169 views

20⟩ how to call a dll as a COM dll?

Inorder to call your DLL as COM dll, you have to follow

some rules to develop the dll. If those rules are there

then only your DLL will be called as COM dll.

COM is a specification set of rules to develope binaries,

COM is not a language.

 171 views