This example generates a unique filename by using the Admin control for an unattended "Save As" operation in the Image Edit control.
void CAdmin1Dlg::OnUniquefilename()
{
CString strNewfile;
Cstring strPath;
// Pass in the directory, template, and file extension for
// the new file
strPath = "D:\\image2"
strNewfile = ImgAdmin1.GetUniqueName(strPath, "test", "tif");
VARIANT evt;
evt.vt = VT_ERROR; // set to error for optional parameter
StrPath + = "\\";
StrPath + = StrNewFile;
ImgEdit1.SaveAs (strPath, evt, evt, evt, evt, evt);
}