Share via


Create method

Implemented by element behaviors and invoked by MSHTML on creation of the element behavior.

Syntax

HRESULT retVal = object.Create(pNamespace);

Parameters

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Examples

The following example shows an implementation of the Create method that adds the "MyTag" element behavior to the namespace that pNamespace points to.

HRESULT CMyFactory::Create(IElementNamespace *pNamespace)
{
    BSTR bstrTagName = SysAllocString(L"MyTag");
    HRESULT hr = pNamespace->AddTag(bstrTagName, 0);
    SysFreeString(bstrTagName);
    return hr;
}