![]() |
off topic
|
MeowMoniker ReadMeOverviewMeowMoniker and Feline are COM objects designed and built by Chris Sells, with a great deal of input from Don Box and Tim Ewald. The MeowMoniker is a custom moniker derived from the CComMoniker class implemented by Don Box, Tim Ewald and Chris Sells. To contact the authors with suggestions or comments, use csells@sellsbrothers.com, tewald@obelisk-llc.com and dbox@microsoft.com. MeowMoniker UsageMicrosoft tags every marshalled interface reference packet with the signature MEOW (which they claim stands for Microsoft Extended Object Wire-representation). This binary packet is a serialized interface reference used for inter-apartment activation. Turning this binary packet into a string (via some encoding technique, i.e. Base64) allows a serialized interface pointer to be passed more easily than binary data, e.g. as a command-line argument or in an HTML page. Monikers, on the other hand, provide a general-purpose way for a client to separate itself from the object binding policy. These object binding polices can be composed and stored in strings. These strings contain a string description of the binding policy and policy parameters. By building a custom moniker that takes a string-ized interface reference as a parameter, a client can use the standard moniker-based binding algorithm and bind to a running object via an interface reference. The MeowMoniker is an implementation of a moniker that can compose display names out of interface pointers and bind to objects via its display names. To create a MeowMoniker from an interface pointer, MeowMoniker.dll exposes the CreateMeowMoniker() function:
e.g.
IMoniker* pmk;
To obtain the MeowMoniker's display name, use the GetDisplayName() member function of the IMoniker interface:
e.g.
IBindCtx* pbc;
To parse a display name composed by the MeowMoniker, OLE32.dll exposes the MkParseDisplayName() function:
e.g.
IBindCtx* pbc;
To bind to a object, use the BindToObject() member function of the IMoniker interface:
e.g.
IUnknown* punk;
Feline UsageSince neither VB nor VBScript supports calling CreateMeowMoniker() and since VBScript has no equivalent of the VB function GetObject(), the Feline object provides a dual-interface for making display names out of interface pointers and parsing moniker display names:
<object classid="clsid:CB18CB8F-C7CC-11D0-9A44-00008600A105"
<object classid="clsid:7CF322E0-29A9-11D0-B367-0080C7BC7884"
<object classid="clsid:CB18CB8F-C7CC-11D0-9A44-00008600A105"
<script language=vbscript>
</BODY>
CComMoniker ImplementationThe MeowMoniker derives most of its functionality from CComMoniker, provided in mkbase.h and mkbase.cpp. This base class implements IMoniker, IParseDisplayName, IROTData and IMarshal (for marshal-by-value). This implementation uses the moniker's display name as the persistent state. The custom moniker implementor deriving from CComMoniker must provide the CSLID of the moniker as the single template parameter (used in the implementation of the GetClassID() member function of IPersist and the GetUnmarshalClass() member function of IMarshal). The implementor may override any of the base class's member functions but must implement these three IMoniker members:
STDMETHODIMP GetDisplayName(
STDMETHODIMP ParseDisplayName(
As a aid in parsing display names, the CComMoniker class provides the following helper function:
e.g.
const wchar_t* ProgID() { return L"dm.meow.1"; }
CoMeowMoniker ImplementationThe MeowMoniker is an ATL object named CoMeowMoniker. It derives from CComMoniker and provides an implementation of the required members only. The bulk of the implementation is contained in the two member functions, MarshalInterface() and UnmarshalInterface(). These two member functions manage the Base64 encoding and decoding of the interface pointer. The actual Base64 implementation is kept in Base64.cpp. CoFeline ImplementationThe Feline is an ATL object named CoFeline. Its implementation of GetDisplayName() uses a MeowMoniker. Its implementation of ParseDisplayName() uses MkParseDisplayName() so that any moniker's display name can be used. YACL
The implementation of the MeowMoniker is based on utilities provided in the
YACL (Yet Another COM Library), developed and maintained by Don Box and
available at Don's YACL web site.
The pieces of YACL
Revisions6/15/98
Copyright
MeowMoniker, copyright (c) 1997, Chris Sells.
|
|||||||||
|
home & news
interviews
tools
the spout
writing
fun
colophon
news
contact
off topic
This page is copyright (c) 1995-2005, Chris Sells. All rights reserved. No warranties extended. Some assembly required. Void where prohibited. You may link to this site freely from your own site. You may quote small excerpts from this site, but please include a link to the original source on this site. |
||||||||||