Article ID: 104139
Article Last Modified on 12/3/2003
Container OLE
----------- -----------
|OleCreate|--->| |
| | | |
| | | |
| | | |
| | | |
| | | |
----------- -----------
The OLE libraries then consult the registration database to find the
name of the executable file associated with the CLSID:
Container OLE
----------- -----------
|OleCreate|--->| |
| | | |
| | | |
| | | |
| | | |
| | | |
----------- -----------
|
V
Reg DB
The server is then started with the -Embedding flag. When the server
parses the command line and sees the -Embedding flag, it knows that it
is being started on behalf of OLE and should remain hidden until it is
explicitly told to become visible. At this point, the server registers
a pointer to its IClassFactory interface with OLE:
Container OLE Server
----------- ----------- -----------------
|OleCreate|--->| |--->| |
| | | |<---| IClassFactory |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
----------- ----------- -----------------
|
V
Reg DB
OLE calls the server through the IClassFactory interface and asks to
instantiate an object, returning the pointer to the interface
requested by the container in the creation routine:
Container OLE Server
----------- ----------- ------------------
|OleCreate|--->| |--->| |
| | | |<---| IClassFactory |
| | | |--->| ------------- |
| | | |<---|-|IOleObject | |
| | | | | |IDataObject| |
| | | | | | etc | |
| | | | | ------------- |
----------- ----------- ------------------
|
V
Reg DB
OLE queries the object for the IDataObject interface, and then calls
GetData method to fill the presentation cache with a metafile,
device-independent bitmap (DIB), or a bitmap. Later, when the
container asks the object to draw itself, OLE will intercept the call
and use one of the entries in the presentation cache:
Container OLE Server
----------- ----------- ------------------
|OleCreate|--->| |--->| |
| | | |<---| IClassFactory |
| | | |--->| ------------- |
| | | |<---|-|IOleObject | |
| | | | | |IDataObject| |
| | | | | | etc | |
| | | | | ------------- |
----------- ----------- ------------------
| |
V v
Reg DB Cache
At this point, the creation routine returns to the container. Now, the
container will generally query the interface pointer returned for the
IViewObject interface. The container uses the IViewObject interface to
ask the object to notify the container (through the container's
IAdviseSink interface) every time the object's view changes, so that
the container can update its display. At this point, the server
creates an advise holder to notify the object of its changes:
Container OLE Server
-------------- ------------- ------------------
| | | | | |
| | | | | IClassFactory |
| | | | | ------------- |
| |--->|IOleObject |----->|IOleObject | |
| | | | | |IDataObject| |
| | | | | | etc | |
| | | | | ------------- |
|IAdviseSink |<---| |<---|IOleAdviseHolder|
-------------- ------------- ------------------
| |
V v
Reg DB Cache
NOTE: The object still is not visible at this point. Now an explicit
call to IOleObject::DoVerb() must be made with the verb OLEIVERB_SHOW.
This tells the server to make the object visible for editing.
----------------
| Root Storage |
----------------
| --------------- * = Stream
|---| object | - = Storage
| | sub-storage |
| ---------------
| | ****************
| |---* OLE State *
| | ****************
| | ****************
| |---* Presentation *
| | ****************
| | ****************
| |---* Native Data *
| ****************
| ***************
| * Container *
|--- * State *
* Information *
***************
The container can continue to redraw the object even though the server
application is no longer around because the object's presentation is
stored in OLE's internal cache:
Container OLE
-------------- -------------
| | | |
| | | |
| | | |
| |--->|IOleObject |
| | | |
| | | |
| | | |
|IAdviseSink |<---| |
-------------- -------------
| |
V v
Reg DB Cache
Now the user can save the document in the container application and
exit. Upon exiting, the container queries the object for the
IViewObject interface so the container can tell OLE to stop sending
updates. Then the container asks the object to close.Additional query words: 2.00 3.50 4.00
Keywords: kbprogramming KB104139