????????? ????? ??? ?????? (http://ce.aut.ac.ir/islab) - PowerPoint PPT Presentation

About This Presentation
Title:

????????? ????? ??? ?????? (http://ce.aut.ac.ir/islab)

Description:

Component COM Interface : – PowerPoint PPT presentation

Number of Views:15
Avg rating:3.0/5.0
Slides: 18
Provided by: Shoh7
Category:
Tags: aut | component | http | islab | model | object

less

Transcript and Presenter's Notes

Title: ????????? ????? ??? ?????? (http://ce.aut.ac.ir/islab)


1
?????? ??? Component ?? ?? COM ?? ???? Interface
  • ????? ??? ?????? ????? ??? ????
  • ????? ??????
  • ???? ?????? ????

2
Component Object Model
  • ????? ?? ?????? ????????? ???? ???????? ?????
  • ????? ?? ???? ?????? ?????
  • ????? ?? ??? ??? ??? ????? (Microsoft Windows,
    Microsoft Windows NT, Apple, Mac, Unix)
  • ????? ??????? ??? ????? Component-based

3
?????? ??? Component ??
  • Component ?? ?? ???? Interface ?? ?? ??????
    ?????? ?????
  • ????? ?? ?? ?? Component ?? ???? ????? ?? ?? ??
    Interface ?? ????
  • ????? ?????? ?? ???? ??? Object ???? ????? (??
    ???? Object ?? ?? C)

4
????? ?? Interface
  • interface ILookup public IUnknown
  • public
  • virtual HRESULT __stdcall LookupByName( LPTSTR
    lpName,TCHAR lplpNumber) 0
  • virtual HRESULT __stdcall LookupByNumber(LPTSTR
    lpNumber, TCHAR lplpName) 0

5
????? ??? Interface
  • Interface ?? ???? ?????? ???
  • Interface ????? ?? Component ?? ??? ?? ?? ??
    ???????? ?? ???
  • Client ?? ??? ? ??? ?? ???? Interface ?? ??
    Component ?? ?? ?????? ?????
  • ?? ?? ?? Component ?? ?? ????? ??? ?? ??
    Interface ????? ????
  • ?? Interface ????? ?? GUID ?? ???? ?? ?????? ??
    ?? ?? ???? ???? ID ?? ????
  • Interface ?? ????? Version ??? ????? ??? ?????

6
???? Interface
?? Component ?? ????? ??? ?? ?? Interface ?????
????
A
Object
B
C
7
???? Interface
Client Application
Object
Interface Pointer
8
???? Interface
Application
Object
Object
Application
9
Global Unique Identifiers
  • 128 ??? ?? ???? ? ???? ???
  • ???? ????? ?? Interface ?? ? Component ?? ?? ???
    ?? ???
  • ????? Human-Readable ???? ?? ????? ????? ?? ?????
    ??? ? ???? ????? ??????? ??? ???
  • ???? ?? ???? ?? Component ?? ?? Component ???
    ?????? ???? ??????
  • ?????
  • Microsoft UUIDgen
  • CoCreateGUID

10
IUnknown Interface
  • ???? ????? ???? ???? ????????? ????? Interface ??
    ??? ?? ???
  • ???? Interface ?? ?? ?? ??? ?? ???? ? Component
    ?? ???? ?? ?? ????? ???? ??????
  • ????? ?? ??? ???? ???
  • QueryInterface
  • AddRef
  • Release

11
IUnknown Interface
  • interface IUnknown
  • virtual HRESULT QueryInterface(IID iid,
    void ppvObj) 0
  • virtual ULONG AddRef() 0
  • virtual ULONG Release() 0

12
QueryInterface
  • ?? ??? ???? ? ?? ???? ???? ???? ?? ????? ?? ??
    Interface ??? ???? Component ???? ??? ????? ??
    ???? ?? ???
  • ???? ??????? ?? ?????? ??? ?? ?? Component ??
    ????? QueryInterface ????? ?? ?? Component ??
    Call ??????
  • Succeed
  • Fail

13
  • LPLOOKUP pLookup
  • TCHAR szNumber64
  • HRESULT hRes
  • //Call QueryInterface on the component object
    PhoneBook, asking for a pointer
  • //to the Ilookup interface identified by a unique
    interface ID.
  • hRes pPhoneBook-gtQueryInterface( IID_ILOOKUP,
    pLookup)
  • if( SUCCEEDED( hRes ) )
  • // use Ilookup interface pointer
  • pLookup-gtLookupByName(Hamid", szNumber)
  • pLookup-gtRelease() // finished using the
    IPhoneBook interface pointer
  • else
  • // Failed to acquire Ilookup interface pointer.

14
Component Object Library
  • ??????? ???? ???? ?????? ??? Component ?? ?? ????
    Interface ?? ?? ????? ?? ???
  • ????? ????
  • ???? ???? ID ????? ?? Component ?? registry
    database
  • exe CoRegisterClassFactory
  • DLL DllGetClassFactory
  • ????? ?? ?? Interface ???? ??? ?????????? ?? ???

15
Client Process
In-Process Component Object
In-Process Server
Client Application
Local Object Proxy
COM
Remote Object Proxy
16
Inter-Process Communication
LRPC
LRPC
Cross-Process With Lightweight RPC
RPC
RPC
Cross-network With true RPC
17
Local Server Process
Local Object
Stub Object
COM
Local Server
Remote Server Process
Remote Component Object
Stub Object
COM
Remote Server
Write a Comment
User Comments (0)
About PowerShow.com