if(pOleClientSite)
{
if(SUCCEEDED(pOleClientSite->GetMoniker(OLEGETMONIKER_FORCEASSIGN,
OLEWHICHMK_OBJFULL, &ptrfullMoniker)))<BR/>
// The typedefs for OLEGETMONIKER and OLWHICHMK are in oleidl.h
{
if (SUCCEEDED(CreateBindCtx( 0, &pbcfull )))
{
if(SUCCEEDED(ptrfullMoniker->GetDisplayName(pbcfull,NULL,<BR/>
&ppszDisplaynamefull)))
{
wcstombs(objectname,ppszDisplaynamefull,300);
AfxMessageBox(ExtractDocumentName(objectname));
ptrfullMoniker->Release();
}
}
pbcfull->Release();
}
pOleClientSite->Release();
}
}
char* CMyActiveXCtrl::ExtractDocumentName(char* objectname)
{
char* ptrchar;
char* ptrdocname;
//reverse the string
ptrchar = _strrev(objectname);
//Ignore the first token , this is the name of the embedded object
strtok(ptrchar,"!");
//get the remainder of the string and reverse it to get the Document name
ptrdocname = strrev(strtok(NULL,"\0"));
return ptrdocname;
}