Objective Toolkit : Chapter 20 ActiveHost Form Scripting and Editing Framework : Using the ActiveHost Form Editing Framework
Using the ActiveHost Form Editing Framework
 
To incorporate ActiveHost into your application
1. As with ActiveScript, set up your application as an OLE control container by adding the following lines to your application’s InitInstance() method.
 
BOOL CScriptApp::InitInstance()
{
. . .
// Initialize OLE libraries, a must for ActiveScript usage.
if (!AfxOleInit())
{
TRACE(_T("Failed to initialize OLE libraries\n"));
return FALSE;
}
SECAScriptOccManager *pScriptOccMgr = new SECAScriptOccManager();
AfxEnableControlContainer( pScriptOccMgr );
2. Modify your document template instantiation in your application’s InitInstance() method so the ActiveHost Document and View classes are created. You may want to derive your document classes or view classes or both from SECScriptHostDoc or SECScriptHostView.
pDocTemplate = new CMultiDocTemplate(
IDR_SCRPTMTYPE,
RUNTIME_CLASS(SECScriptHostDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(SECScriptHostView));
3. If you want to support direct scripting access to this application (for example, through the SECAAppObj class), make the following document template entry. Use all three of the run-time classes listed below or use derived classes.
 
SECAFloatDocTemplate* pFloatDocTempl=
new SECAFloatDocTemplate(IDR_TOPLEVEL,
RUNTIME_CLASS(SECScriptHostDoc),
RUNTIME_CLASS(SECADlgFrame),
RUNTIME_CLASS(SECScriptHostView));
AddDocTemplate(pFloatDocTempl);