COM , OLE concept

Download Report

Transcript COM , OLE concept

COM , OLE concept
By topgun
src = Write Ole Control
Java
Java app
Java app
Java virtual machine
Java virtual machine
Java machine
x86 instruction set
Java machine
Sparc instruction set
我猜的
OLE
OLE(activex)
COM
binary standard
x86 instruction set
我猜的
COM object
OLE(control)
OLE(automation)
COM
COM
binary standard
binary standard
x86 instruction set
script
Object 長相
我覺得
Browser
Java applet
Active x Container
Activex control
Activex relationship
(container)
Activex automation
(Server)
Activex control
(Client)
Active X technology




OLE(Active x) Automation (Server)
OLE(Active x) Document
OLE(Active x) Control
…….
Client-Server Model
Server 一定是一個COM object
Client 不一定要是Com object
OLE architecture
Local and In-process Server (1)
Local Server
In-process Server
Local and In-process Server (2)
Local Server
Local Server live in EXE file. Client and local sever live in different
process space. The OLE library take care of passing back and forth
between them.
Local Server
In-process Server
In-process Server live in DLL file. The host process loads the DLL that
contains the COM Server . This means that the in-process server lives
In-process
in the same
processServer
space as its host .
Marshaling
Transport Data across a process boundary
( function parameters and return Value )
Local Server
In-process Server
Proxies and stub
Local Server
Standard and Custom Marshaling
OLE Library accomplish standard marshaling use
Built-in proxies and stubs
OLE Library accomplish Custom marshaling use
custom proxies and custom stubs
GUID



CLSID -- a COM server’s GUID is called
its class ID(SERVER)
IID -- is a GUID that distinguishes one
particular interface from all others(COM)
DISPID -- Dispath ID are numeric
identifers that the OLE library use to
identify your OLE Control’s property and
methods(Control).
Interface (keypad of ATM)




提供輸入的服務
以 regular 和 predictable 方式提供服務-例如都是夫入數字與命令
是不變的--如果被廣泛使用就不可以改變
是可以預測的--按下enter button 是最後一
個指令在波士頓即在三番市,這件事都
是對的.
Interface concept
Interface are Specifications Only
COM Interface define a protocol but
----- in no way implement that protocol
Class Icalculate
{
public :
virtual double sum (double, double)=0;
virtual double product (double, double)=0;
};
Containment
Delegation
?
(委派)
Aggregation (集合體)
COM SERVER 來實現 “REUSE“的機制
OLE Dcument
ActiveX Document is COM
software components that present
data and information to the user.
ActiveX Document allow user
to view data in a variety of
ways,perhaps as a graph,
a spreadsheet, or text
Structured Storage
Store
Save
stream
COM
Server
Stream
Compound Document
Support fellow feature
Nested object support
object conversion
optimized object storage
object linking and embedding
Naming ,Binding and Monikers
Com object store the name
and location of other object
Binding
Container
OLE Automation
Automation Server
Expose its method (functionality) and properties
( characteristics )to other objects and application
IDispath
OLE control
Container

OLE control s have three sets of attributes
that are expose to the outside world
Request



Property
Methods
Event
Property
(member variable in c)

properties are named attributes or
characteristics of an OLE control -----------Some example of properties are
color ,font,number.
Property page

OLE control provide access to their
properties though property page(sheet)
(Clock object,might have a property called DisplayType
,which indicate digital or analog)
是一種由OLE控制元件所定義的一種使用者介面,
允許使用者直接處理控制元件的property,不需要
Property can be changed
container的任何介入
programmatically or though a UI
mechanism call property page
Method
OLE Automation properties,method (argument) and (return types)
(member function in c)
-----------------------------------------------------------------(argument and return )data type
1. VARIANT
2.SAFEARRAY
 Method are function
that client use
BSTR
the actions of OLE3. servers.
to direct
Vt  Method
VARENUM
VARIANT中的資造型態
are only
accessible via OLE
iVal automation(IDispath)
short
短整數
IVal long
……………還很多
常整數
Event

OLE object raises an event when
something interesting happens
container
Mouse event
OLE control
Control and Automation
OLE Control implement IDispatch to implement OLE Automation
Registry
Point to the control’s Type Library
<vendor>.<Server
name>.<version
name>of
Type Library contains
the descriptions
object “word.Document.6”
class,interface,dispatch interface
( OLE automation) and type define
Conclusion
Control :ocx
automation :exe and DLL
control
automation
?
Automation &automation