Solved

COM

Posted on 2000-03-25
3
192 Views
Last Modified: 2013-11-25
In vtable the first three address of functions are the IUknown interface methods then after that comes our own methods .Now the question is why not get the pointer to the vtable and iterate through the vtable to reach the method we want ?What role does QuerryInterface() plays ?Why should i use QuerryInterface().
0
Comment
Question by:r_sam_14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Author Comment

by:r_sam_14
ID: 2656843
Please give your email id so that we can exchange technical ideas.
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 2656928
QueryInterface is kind of a query booth where you ask from a COM object about the inercaces it supports. Some interface designer don't use QI for this purpose especially if you have more than interfaces implemented then the scripting languages can not excess interface other than that has been marked as default. In that case you may come across implementation like

HRESULT GetInerfaceFoo1 ();
HRESULT GetInterfaceFoo2 ();

The purpose for this type of design is that you specifically ask for an interface from a COM object.

C implementation does the same thing as getting to a method by applying offset to vtable pointer.

Andif you look at the implementation of ATL, it has similar kind of approach. You will come across ATL_THUNKxxx.
0
 
LVL 1

Accepted Solution

by:
kkarunakar earned 35 total points
ID: 2694686
Hi Sam,
It is not matter to discuss that we can get the pointer of vtable and iterate thru that.The Important thing is to note here is that . The architecure of COM is like that..We have to use QueryInterface() function of COM object to get the interface it supports. After getting the interface pointer we can access the method, event , properties of the Interface. For showing this it is done thry vtable. COM is said to be platform independent and language independent. And there are languages which does not have vtable concept. In that case we can't use ur logic.
And after all they have implemented like this architecture.
And It is more robust.And U will find benefit of this when u will forward with other chapters..
Regards keshav
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question