RegisterGlobalName

This method is similar to the RegisterName() method, but the names (objects) registered with it are also available to other clients including the TerraExplorer itself.

 

For example, assume that you have created a TerraExplorer Hotlink Tree Message and this message is using the following script:

 

   TheClient.Navigate "http://www.skylinesoft.com"

 

Clicking this link (on the information tree) will result in an error since “TheClient” object is unknown to TerraExplorer. If however, you have opened an HTML window that was executing the following code:

 

   Set IScriptEngine = TE.interface("IScriptEngine5")

   IScriptEngine.RegisterGlobalName "TheClient", Me

 

Then when you click in the information tree hotlink, this HTML navigates to the Skyline website, since TerraExplorer now knows that “TheClient” object actually refers to the HTML window.

This is a very powerful tool since, for example, you can create script messages in TerraExplorer that use a database connection that is supplied to TerraExplorer only in runtime.

 

As with RegisterName() method, the “this” method is a reserved keyword.

To unregister a global name, use the UnregisterName() method.

 

Note: since several clients can register global names at the same time, try to make names as unique as possible to avoid confusion with other global registered names (e.g., MyClientName_MyVariableName).

 

HRESULT RegisterGlobalName(

 [in] BSTR Name,

 [in] IUnknown* punkItem,

 [in, defaultvalue(0)] long Flags)

Parameters:

Return Values:

The return value obtained from the returned HRESULT can be one of the following:

Return value

Meaning

S_OK

Success.

E_FAIL

Catastrophic failure.

E_INVALIDARG

Invalid argument. This is usually one of the following:

"Reserved Name"

"Name already registered"

"NULL IUnknown"