We will include a toolbar, a status bar and the toolbar will have a normal look.

For the step 5 of 6 we will not have any changes.
And finally the 6th step will bring a window with the filenames. We will not operate any changes here.
The classes made are: CAboutDlg, CEvolApp, CEvolCntrItem, CEvolDoc, CEvolView, CMainFrame.
Now we will have to make some changes and adding to the code.
For the class CEvolDoc, the one who is manipulating the document itself, we will some functionality. Here you will develop the routine that is loading the ActiveX. In the public section of the header add:
ICatInformationPtr m_pCatInfo;
CArray< CATID, CATID& > m_aImplementedCategories;
CArray< CATID, CATID& > m_aRequiredCategories;
CList< CLSID, CLSID& > m_lControls;
CEvolCntrItem* pItem;
Next you will have to add some code the function OnNewDocument():
BOOL tDone;
HRESULT hResult;
IEnumGUIDPtr pEnum;
CLSID clsid;
LPOLESTR pszName;
CString strName;
ULONG nImplementedCategories,iCategory;
CATID* pcatidImpl;
ULONG nRequiredCategories;
CATID* pcatidReq,catid;
POSITION posControl;
tDone = FALSE;
posControl=m_lControls.GetHeadPosition();
// clsid=m_lControls.GetNext(posControl);
if(!posControl)
{
hResult =m_pCatInfo.CreateInstance( CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER );
if( FAILED( hResult ) )
{
TRACE( "Failed to create category manager\n" );
return FALSE;
}
catid = CATID_Control;
m_aImplementedCategories.Add( catid );
nImplementedCategories = m_aImplementedCategories.GetSize();
if( nImplementedCategories == 0 )
{
nImplementedCategories = ULONG( -1 );
pcatidImpl = NULL;
}
else
{
pcatidImpl = (CATID*)_alloca( nImplementedCategories*sizeof( CATID ) );
for(iCategory = 0; iCategory < nImplementedCategories; iCategory++ )
{
pcatidImpl[iCategory] = m_aImplementedCategories[iCategory];
}
}
nRequiredCategories = m_aRequiredCategories.GetSize();
if( nRequiredCategories == 0 )
{
pcatidReq = NULL;
}
else
{
pcatidReq = (CATID*)_alloca( nRequiredCategories*sizeof( CATID ) );
for( iCategory = 0; iCategory < nRequiredCategories; iCategory++ )
{
pcatidReq[iCategory] = m_aRequiredCategories[iCategory];
}
}
hResult = m_pCatInfo->EnumClassesOfCategories( nImplementedCategories, pcatidImpl, nRequiredCategories, pcatidReq, &pEnum );
if( FAILED( hResult ) )
{
return FALSE;
}
tDone = FALSE;
while( !tDone )
{
hResult = pEnum->Next( 1, &clsid, NULL );
if( hResult == S_OK )
{
pszName = NULL;
hResult = OleRegGetUserType( clsid, USERCLASSTYPE_FULL, &pszName );
if( SUCCEEDED( hResult ) )
{
strName = pszName;
CoTaskMemFree( pszName );
pszName = NULL;
if(strstr(strName, "EvolActiveX"))
posControl = m_lControls.AddTail( clsid );
}
}
else
{
tDone = TRUE;
}
}
}
if(tDone)
{
pItem=NULL;
Load();
}
Attachments
Project Files Demo Files