### Class DynamicPolicy - A policy which dynamically (ie, at run-time) determines public interfaces.

## SYNOPSIS

    import win32com.server.policy

    class DynamicPolicy(BasicWrapPolicy)
      def _getidsofnames_(self, names, lcid)
      def _invoke_(self, dispid, lcid, wFlags, args)
      def _wrap_(self, object)

      # Methods inherited by DynamicPolicy from BasicWrapPolicy
      def _CreateInstance_(self, clsid, reqIID)
      def _GetIDsOfNames_(self, names, lcid)
      def _Invoke_(self, dispid, lcid, wFlags, args)
      def _QueryInterface_(self, iid)
      def __init__(self, object)
      def _query_interface_(self, iid)

## DESCRIPTION

A dynamic policy is used to dynamically dispatch methods and properties to the wrapped object. The list of objects and properties does not need to be known in advance, and methods or properties added to the wrapped object after construction are also handled.

The wrapped object must provide the folliwng attributes:

_dynamic_
  A method that will be called whenever an invoke on the object is called. The method is called with the name of the underlying method/property (ie, the mapping of dispid to/from name has been resolved.)

### def _CreateInstance_(self, clsid, reqIID)

Creates a new instance of a wrapped object

This method looks up a "win32com.server.policy.regSpec" % clsid entry in the registry (using DefaultPolicy)

### def _GetIDsOfNames_(self, names, lcid)

The main COM entry-point for GetIDsOfNames.

This checks the validity of the arguments, and calls the _getidsofnames_ helper.

### def _Invoke_(self, dispid, lcid, wFlags, args)

The main COM entry-point for Invoke.

This calls the _invoke_ helper.

### def _QueryInterface_(self, iid)

The main COM entry-point for QueryInterface.

This checks the _com_interfaces_ attribute and if the interface is not specified there, it calls the derived helper _query_interface_

### def __init__(self, object)

Initialise the policy object

Params:

object
  The object to wrap. May be None iff BasicWrapPolicy._CreateInstance_ will be called immediately after this to setup a brand new object

### def _query_interface_(self, iid)

Called if the object does not provide the requested interface in _com_interfaces, and does not provide a _query_interface_ handler.

Returns a result to the COM framework indicating the interface is not supported.

## SEE ALSO

win32com.server.policy

win32com.server.policy

Copyright © Greg Stein and Mark Hammond
All Rights Reserved
Comments to author: dev@null
Generated: Sun Apr 20 1997