MICROSOFT COM - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

MICROSOFT COM

Description:

'Free threading apartments' Windows NT. No message queue ... 'wireless instant voice messaging using the internet' by. Carlos A. Rivera, 2002 ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 23
Provided by: lailar
Category:

less

Transcript and Presenter's Notes

Title: MICROSOFT COM


1
MICROSOFT COM
(COMPONENT OBJECT MODEL)
Develpment Methodologies
Presented By LAILA ROHANI
2
CONTENTS
  • MIDLs
  • Creating a simple COM object
  • Interface Design Issues
  • Implementing COM in VB and VC
  • Java COM Integration Model
  • COM Threading Models
  • Conclusion
  • References

3
MICROSOFT INTERFACE DEFINITION LANGUAGE
  • Language independent
  • Declaration language
  • NOT a programming language
  • Syntax ? similar to C ? MUCH MORE!!!
  • Type library
  • Not mandatory

4
object, uuid (122323FAGAd098776)
Interface IFindSum IUnknown import
unknown.idl HRESULT SumOfNumbers (inlong
Inum, inlong Inum2, out, retval long
sum)
  • IUnknown
  • QueryInterface
  • AddRef
  • Release

5
CREATING A SIMPLE COM OBJECT
CLIENT
calls API functions
CoCreateInstance
CoGetClassObject (class factory)
locate
SCM
Class object
search
Windows Registry Location (HKEY_CLASSES_ROOT\CLSID
)
Internal db
returns interface pointer
IClassFactory
releases
CreateInstance
6
DESIGN ISSUES
  • Naming
  • Factoring
  • Contract Strictness
  • Success Codes
  • Use of Unions
  • By-value parameters
  • Passing Interface Pointers
  • Callbacks
  • Enumerators
  • In-process OR Out-process

7
COM IN VC AND VB
8
Fax Service Client API
9
CoCreateInstance
VC
FaxServer object
IFaxServerConnect
IFaxServerDisconnect
GetPorts
CreateDocument
GetJobs
IunknownRelease
FaxDoc
FaxPorts
FaxJobs
Send
GetRoutingMethods
GetStatus
FaxRoutingMethods
getItem
FaxStatus
FaxRoutingMethod
10
CreateObject
VB
Connect
Disconnect
FaxServer object
GetPorts
CreateDocument
GetJobs
FaxDoc
FaxJobs
FaxPorts
Send
GetStatus
GetRoutingMethods
FaxStatus
FaxRoutingMethods
11
JAVA COM INTEGRATION MODEL
  • MS VJ
  • no new keywords
  • Special tools for integration
  • Java Type Library Wizard
  • automates java class wrappers creation
  • Java TLB
  • converts type library function into java .class
    files
  • JavaReg
  • register Java classes

12
(No Transcript)
13
  • external object java object
  • Garbage Collection ? not concerned with keeping
    tracks
  • of unusable objects

public class DooHickey static int counter
0 DooHickey() new MessageBox("DooHickey,
from Visual J") public int Sum(int x, int
y) return x y public void
Greet(String message) counter new
MessageBox(message " - Strike " counter)
if(counter 3) counter 0 throw
new com.ms.com.ComFailException("You're out!")

14
Create an IDL file
(vjwidget.idl)
Compile into TLB using MkTypLib utility
(vjwidget.tlb)
Generate class wrappers
(DooHickey.class IDooHickey.class)
Set output directory (windir\java\lib)
Modify codes for implementing interface
Register the java class (UUID)
15
COM THREADING MODELS
  • What is a thread???
  • What is an apartment???
  • thread lt gt apartment
  • objects are created in an apartment
  • one specific instance one apartment
  • model cannot be changed

16
  • 4 Types
  • Single Threaded Apartments
  • Multi Threaded Apartments
  • Mixed Threading Model
  • Thread Neutral Apartments

17
SINGLE THREADED APARTMENTS
  • one thread
  • initialized by CoInitialize
  • At a time, only one thread can be executed from
    callers
  • message queue (serially)
  • window messaging system
  • DEADLOCKS!!!

18
MULTI THREADED APARTMENTS
  • Free threading apartments
  • Windows NT
  • No message queue
  • multiple threads can access a single object
  • sharing the apartment
  • Protect object / class ???

19
MIXED THREADED APARTMENTS
  • One MTA
  • Many STA
  • STA ? calls are synchronized by Windows
  • MTA ? No synchronization

20
THREAD NEUTRAL APARTMENTS
  • Almost same as MTA
  • Each class instance ? single thread
  • Thread executes a method in COM
  • New object is created
  • Current thread is suspended
  • New thread is created to handle new object
  • Thread obtains an apartment wide lock

21
CONCLUSION
  • Makes life easier in interfacing
  • Encapsulation
  • Language friendly ?
  • Mobility
  • Resusability

22
REFERENCES
  • www.microsoft.com
  • msdn.microsoft.com
  • www.idevresource.com
  • www.devarticles.com
  • www.peterindia.com
  • my.execpc.com/gopalan
  • wireless instant voice messaging using the
    internet by
  • Carlos A. Rivera, 2002
  • Operating Systems Design and Implementation,
    Andrew
  • Tanenbaum and Albert S. WoodHull
Write a Comment
User Comments (0)
About PowerShow.com