|Microsoft® Windows® Script Interfaces
| Language Reference
HRESULT GetScriptDispatch( LPCOLESTR pstrItemName // address of item name IDispatch **ppdisp // receives IDispatch pointer );
Retrieves the IDispatch interface for the methods and properties associated with the currently running script.
|E_INVALIDARG||An argument was invalid.|
|E_POINTER||An invalid pointer was specified.|
|E_UNEXPECTED||The call was not expected (for example, the scripting engine has not yet been loaded or initialized).|
|S_FALSE||The scripting engine does not support a dispatch object; the ppdisp parameter is set to NULL.|
Because methods and properties can be added by calling the IActiveScriptParse interface, the IDispatch interface returned by this method can dynamically support new methods and properties. Similarly, the IDispatch::GetTypeInfo method should return a new, unique ITypeInfo interface when methods and properties are added. Note, however, that language engines must not change the IDispatch interface in a way that is incompatible with any previous ITypeInfo interface returned. That implies, for example, that DISPIDs will never be reused.