AnnGetNameRestrict example for C++ 5.0 and later

//This sample toggles the bNameRestrict property of the annotation object hObject
void CVCsampleLoadMemoryDlg::SampleNameRestrict(OLE_HANDLE hObject) 
{
   BOOL bNameRestrict; 
   CString strMsg; 

   bNameRestrict = m_Lead1.AnnGetNameRestrict (hObject); 
   bNameRestrict = !bNameRestrict; 
   
   if (bNameRestrict) 
      strMsg = "Changing NameRestrict property to TRUE";
   else
      strMsg = "Changing NameRestrict property to FALSE";
   
   MessageBox(strMsg); 
   m_Lead1.AnnSetNameRestrict (hObject,  bNameRestrict, FALSE); 
}