MFC 怎么新建一个 Word 文件并读出最近打开的文件

MFC 如何新建一个 Word 文件并读出最近打开的文件。
MFC 如何新建一个 Word 文件并读出最近打开的文件。并关闭保存这个文件,但不能同时关闭其它已经打开的word文件窗口。

下面是C#实现的代码有朋友帮我转写一下吧。

  //创建Word文档
  Word.Application WordApp = new Word.ApplicationClass();
  Word.Document WordDoc = WordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);

  for (int i = 1; i <= WordApp.Application.RecentFiles.Count; i++)
  {
  string mubiaofiles = WordApp.Application.RecentFiles[i].Path + "\\" + WordApp.Application.RecentFiles[i].Name;//目标文件
  string tempfiles = info.FullName + "\\" + WordApp.Application.RecentFiles[i].Name;//临时文件

  if (System.IO.File.Exists(@"" + mubiaofiles + ""))//判断目标文件是否存在
  {
  if (System.IO.File.Exists(@"" + tempfiles + ""))//判断临时目录是否有重名文件存在
  {
  string delFile = tempfiles;//删除目录中重名文件
  File.Delete(delFile); //删除目录中重名文件
  File.Copy(mubiaofiles, tempfiles);//复制最新文件到临时目录保存为临时文件
  }
  else
  {
  File.Copy(mubiaofiles, tempfiles);//复制最新文件到临时目录保存为临时文件
  }

  MyClass.wordfiles = tempfiles;
  SendMail();
  // MessageBox.Show(MyClass.wordfiles);
  }
  else
  {
  //MessageBox.Show("no");
  }

  }

------解决方案--------------------
_WordApplication m_wordApp;//定义Word提供的应用程序对象
Documents m_wordDocs;//定义Word提供的文档对象
_Document m_wordDoc; //当前的的文档对象

m_wordDocs.ReleaseDispatch();
m_wordDoc.ReleaseDispatch();
m_wordApp.m_bAutoRelease=true;

if(!m_wordApp.CreateDispatch("Word.Application")) //创建Word应用服务

AfxMessageBox("创建Word应用服务失败!"); 
return FALSE; 
}

m_wordApp.SetVisible(FALSE); //设置为隐藏
//下面是打开文件定义VARIANT变量;
COleVariant varFilePath(lpszFileName);
COleVariant varstrNull("");
COleVariant varZero((short)0);
COleVariant varTrue(short(1),VT_BOOL);
COleVariant varFalse(short(0),VT_BOOL);

m_wordDocs.AttachDispatch(m_wordApp.GetDocuments());//将Documents类对象m_Docs和Idispatch接口关
m_wordDoc.AttachDispatch(m_wordDocs.Add(varstrNull,varstrNull,varstrNull,varstrNull));
RecentFiles WordRFiles;
WordRFile.AttachDispatch(m_wordApp.GetRecentFiles());
for (int i = 1; i <= WordRFile.Count(); i++)
WordRFile.Item(i)
....
大概是这样的过程吧,没测试过
------解决方案--------------------
RecentFiles WordRFiles;
WordRFiles.AttachDispatch(m_wordApp.GetRecentFiles());
for (int i = 1; i <= WordRFile.Count(); i++)
WordRFiles.Item(i)