EQuestionAnswers.com Computer/Electronics Questions and Answers
C, C++, VC++, COM/DCOM, DLL and more
#Login #Sign up  Facebook Twitter TGoogle+

#Previous question #Index of COM/DCOM Questions #Next question


Interface is a collection of function definitions to access a COM class. C++ way to define an interface is a class with one or more pure virtual functions.

class interface ICalculate : public IDispatch
  virtual HRESULT __stdcall Operand1(long *pVal) = 0;
  virtual HRESULT __stdcall Operand1(long newVal) = 0;
  virtual HRESULT __stdcall Operand2(long *pVal) = 0;
  virtual HRESULT __stdcall Operand2(long newVal) = 0;
  virtual HRESULT __stdcall DoOperation(char operation) = 0;
  virtual HRESULT __stdcall Result(long *pVal) = 0;

An interface should have an unique GUID and name. Interface is generally defined using interface definition language in an IDL file.

  helpstring("ICalculate Interface tiny calculator demo opject"),
interface ICalculate : IDispatch
  [propget, id(1), helpstring("Operand1 of calculator")] HRESULT Operand1([out, retval] long *pVal);
  [propput, id(1), helpstring("Operand1 of calculator")] HRESULT Operand1([in] long newVal);
  [propget, id(2), helpstring("Operand2 of calculator")] HRESULT Operand2([out, retval] long *pVal);
  [propput, id(2), helpstring("Operand2 of calculator")] HRESULT Operand2([in] long newVal);
  [id(3), helpstring("calculator main Operation method")] HRESULT DoOperation([in] char operation);
  [propget, id(4), helpstring("Result of calculator")] HRESULT Result([out, retval] long *pVal);


Co-Classes are the component class implemented in com server. Co class can have multiple interfaces implemented in it. There will be at least one default interface. Interface methods and properties are used to access a co-class. Co-class should have a name and unique GUID.

library MATHLIBLib

    helpstring("Calculate Class")
  coclass Calculate
    interface ICalMode;
    [default] interface ICalculate;

You have viewed 1 page out of 66. Your COM/DCOM learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

# COM DCOM Interview Questions and Answers :: ALL Interview .com
# COM DCOM - COM DCOM Interview Questions
# COM interview questions | TechInterviews
# COM Interview Questions - CodeProject
# Com Dcom Interview Questions - Com and Dcom in Asp Net
# ATL Interview Questions and Answers :: ALL Interview .com
# ActiveX Interview Questions and Answers :: ALL Interview .com

* #1 webmaster Tue 29 Apr/2014 13:05:16(GMT)  Like 0 Unlike 0

Dear Users,

We are pleased to inform you that a forum/blog has been incorporated with www.mybestnotes.co.in. You are welcomed to add your comments, requests, codes, solutions and feedback to it. Please login(if already a member) or signup(for free) to avail to this facility.


Your message goes here:

My Post:*
Secutiry Code: ******  *
Preview this compose before posting this in discussion forum.
  1. Use [Sxx] code to show smiles. Example [S02]
  2. Use [URL ], example [URL http://www.google.com/]
  3. To display code or un formatted text use [CODE] [/CODE]. Example: [CODE] printf("Hello world"); [/CODE]
 [S01]   [S02]   [S03]   [S04]   [S05]   [S06]   [S07]   [S08] 
 [S09]   [S10]   [S11]   [S12]   [S13]   [S14]   [S15]   [S16] 
 [S17]   [S18]   [S19]   [S20]   [S21]   [S22]   [S23]   [S24] 

Note: Only members are allowed, * fields are mandatory.