GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  Visual Basic
Go To First  |  Previous Question  |  Next Question 
 Visual Basic  |  Question 372 of 453    Print  
what are the three methods in IUnknown interface and their use?

  
Total Answers and Comments: 1 Last Update: March 21, 2006     Asked by: ashok 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 21, 2006 06:11:52   #1  
ferpferp Member Since: March 2006   Contribution: 1    

RE: what are the three methods in IUnknown interface a...

COM uses a method of reference counting to keep track of when the resources taken up by the object can be physically released. Basically it works like this. A object instance is created in a program and a reference is held against it. The reference count is 1. If another reference is made to the same instance of the object the reference count is incremented by 1 so it is now 2. If the first reference is set to nothing the reference count is decremented but as far as COM is concerened the object is still alive as the reference count is not 0. When the last reference is set to nothing the count is decremenetd to 0 and COM can release the resources used by the object back to the system.

As a result of the above all COM classes implement these 3 methods:-

  • QueryInterface
  • AddRef
  • Release

The QueryInterface method is used by COM to query whether the component supports a particular interface (so it is passed an Interface ID). If it does support it a pointer is returned to IUnknown otherwise NOTSUPPORTED value is returned (can't remember the exact name)

AddRef is responsible for the increment of the reference count.

Release is responsible for the decrement of the reference count.

Thus circular references are a real problem within COM and Garbage collection employed under .Net is one of the ways around this problem.


 
Is this answer useful? Yes | No

 Related Questions


What methods are called from the ObjectContext object to inform MTS that the transaction was successful or unsuccessful?
Answer posted by sanjeev prabhudesai on 2005-05-17 00:42:27: onTransactionComplete 

Answer posted by sanjeev prabhudesai on 2005-05-17 00:35:00: INTERFACE were introduced to support Callback 
Latest Answer : Address Of operator is used to support Callback Functions in VB. ...


No Properties Available. Only the methods they are SetText, GetText, Setdata(), Getformat(), Clear.  

Properties – Public variable of a Class Method – Public procedure of a class  

Similarly to arrays but is preferred over an array because of the following reasons. 1. A collection objects uses less Memory than an array. 2. It provides methods to add and delete members. 3. It does 

This cannot have user interface. This can be used for the COM creation.  

Microsoft ODBC driver will support all the methods and properties of Visual Basic. Where as the Oracle not.  

Messaging Application programming Interface.  


 Sponsored Links

 
Related Articles

High-Speed Serial Interface (HSSI)

High Speed Serial Interface HSSI HSSI is High Speed Serial Interface was first developed by Cisco systems and the main purpose was to solve high speed requirement issues The main application of HSSI is on the Wide Area Networks and it helps to enhance the data flow speed on these networks It can wor
 

Fiber Distributed Data Interface (FDDI)

Fiber Distributed Data Interface FDDI The Fiber Distributed data interface or the FDDI is a 100 mbps line using the LAN network and is connected through a fiber optic cable The FDDI technology is used where the networks need a high speed bandwidth and need to cover huge distances than the copper wir
 

jQuery - Basic Alphabetical Sorting

Learning jQuery Basic Alphabetical Sorting Now let s perform a sort on the Title column of the table We ll need a class on the table header cell so that we can select it properly geshibot lang html" Title Author s Publish Date Price geshibot mosgoogle To perform the actual s
 

Working with XML in Visual Basic

Working with XML in Visual Basic Extensive markup language and Visual Basic is the odd couple of the industry Visual Basic is one of the most common languages that are being used today This Microsoft introduced language was meant to be middle tier in characteristic but has managed to get the top tie
 

SDLC Model Basic Stages

SDLC or the Software Development Life Cycle refers to the steps involved in creating a software from scratch.  During earlier days, software used to be scarce and its creation was comparatively easier.  Developers could create any programs they want and experience no competition. I
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

Basic PC Skills

For those that have decided to walk into the world of technology, they may be overwhelmed by the types of knowledge that are available.  There are several code languages and words as well as different areas that you can move into.  If you are a beginner in technology, you can fin
 

JavaScript Window Object Timeout Methods

JavaScript Window Object Timeout Methods In this JavaScript tutorial you will learn about setTimeout clearTimeout and open methods of window object along with syntax usage and examples for each method mosgoogle center setTimeout The setInterval method of Window object is used to call a function or
 

JavaScript Document Object Methods Part II

JavaScript Document Object Methods Part II In this JavaScript tutorial you will learn about document object methods getElementsByTagName getSelection handleEvent releaseEvents routeEvent write writeln along with syntax examples and brief explanation mosgoogle center getElementsByTagName The the getE
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape