SetUserDictionary Example for C++ 5.0 and later

void CSample_COMDlg::OnButton31()
{
   int nRet = pRasterDoc->SetUserDictionary(TRUE); 
   if (nRet == 0) 
   {
      pRasterDoc->AddItemToUserDictionary ("cities","Peabody");
      pRasterDoc->AddItemToUserDictionary ("cities","Budapest");

      pRasterDoc->DictionaryFileName = "USERDIC1.DIC";
      pRasterDoc->DictionaryDefaultSection = "cities";
      pRasterDoc->DictionaryItemAttribute = USER_DICT_LITERAL; 

      nRet = pRasterDoc->SetUserDictionary (FALSE); 
      if (nRet == 0) 
         AfxMessageBox(TEXT("The user dictionary was saved to a file."));
   }
}