|Microsoft Windows Script Interfaces|
Retrieves the IDispatch interface for the methods and properties associated with the currently running script.
HRESULT GetScriptDispatch( LPCOLESTR pstrItemName // address of item name IDispatch **ppdisp // receives IDispatch pointer );
[in] Address of a buffer that contains the name of the item for which the caller needs the associated dispatch object. If this parameter is NULL, the dispatch object contains as its members all of the global methods and properties defined by the script. Through the IDispatch interface and the associated ITypeInfo interface, the host can invoke script methods or view and modify script variables.
[out] Address of a variable that receives a pointer to the object associated with the script's global methods and properties. If the scripting engine does not support such an object, NULL is returned.
Returns one of the following values:
An argument was invalid.
An invalid pointer was specified.
The call was not expected (for example, the scripting engine has not yet been loaded or initialized).
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.