Microsoft® Windows® Script Interfaces IActiveScriptParse::AddScriptlet |
Language Reference Previous Next |
HRESULT AddScriptlet( LPCOLESTR pstrDefaultName, // address of default name of scriptlet LPCOLESTR pstrCode, // address of scriptlet text LPCOLESTR pstrItemName, // address of item name LPCOLESTR pstrSubItemName, // address of subitem name LPCOLESTR pstrEventName, // address of event name LPCOLESTR pstrDelimiter, // address of end-of-scriptlet delimiter DWORD dwSourceContextCookie, // application-defined value for debugging ULONG ulStartingLineNumber, // starting line of the script DWORD dwFlags, // scriptlet flags BSTR *pbstrName, // address of actual name of scriptlet EXCEPINFO *pexcepinfo // address of exception information );
Adds a code scriptlet to the script. This method is used in environments where the persistent state of the script is intertwined with the host document and the host is responsible for restoring the script, rather than through an IPersist* interface. The primary examples are HTML scripting languages that allow scriptlets of code embedded in the HTML document to be attached to intrinsic events (for instance, ONCLICK="button1.text='Exit'").
Return Value | Meaning |
S_OK | Success. |
DISP_E_EXCEPTION | An exception occurred in the parsing of the scriptlet; the pexcepinfo parameter contains information about the exception. |
E_INVALIDARG | An argument was invalid. |
E_NOTIMPL | This method is not supported; the scripting engine does not support adding event-sinking scriptlets. |
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) and therefore failed. |
OLESCRIPT_E_INVALIDNAME | The default name supplied is invalid in this scripting language. |
OLESCRIPT_E_SYNTAX | An unspecified syntax error occurred in the scriptlet. |
Return Value | Meaning |
SCRIPTTEXT_ISVISIBLE | Indicates that the script text should be visible (and, therefore, callable by name) as a global method in the name space of the script. |
SCRIPTTEXT_ISPERSISTENT | Indicates that the code added during this call should be saved if the scripting engine is saved (for example, through a call to IPersist*::Save), or if the scripting engine is reset by way of a transition back to the initialized state. For more information about this state, see Script Engine States. |
Ayuda de Javascript y Vbscript para Javascripts.astalaweb.com. |