我今天在仿照书里面做报表的时候发现编译连接都没有问题,最后点击新建报表时就出问题了,我在对话框里面用了
  Crystal Report Viewer Control 9和 Embeddable Crysta Reports 9 Designer
下面的是我的代码:void CCrystalDlg::InitReport(BOOL bNew)
{
//定义报表变量
  CLSID CLSID_Application;
  //实例化报表
  CLSIDFromProgID(L"CrystalDesignRunTime.Application.9",&CLSID_Application);
  HRESULT hr= CoCreateInstance(CLSID_Application,NULL,CLSCTX_INPROC_SERVER,
  _uuidof(IApplication), (void ** ) &m_Application);
  ASSERT(SUCCEEDED(hr));
  //如果是新增报表
  if(bNew)
  {
  //获取m_Report变量
m_Report = m_Application->NewReport();
  }
  //如果是打开报表
  else
  {
  //定义打开类型
  static const char BASED_CODE szFilter[] = "Crystal Reports|*.rpt||";
  CFileDialog FileDlg(TRUE,"*.rpt",NULL,OFN_EXPLORER,szFilter);
  int iReturn = FileDlg.DoModal();
  if(iReturn == IDOK)
  {
  //获取文件名
  _bstr_t FileName(FileDlg.GetPathName().AllocSysString());
//获取m_Report变量,并打开报表
  m_Report = m_Application->OpenReport(FileName);
  }
  else 
  if(iReturn = IDCANCEL)
  {
  return;
  }
}
  //设置报表设计器对象
  m_CtrlReportDesigner.SetReportObject(m_Report);
  //设置报表浏览器对象
  m_CtrlReportViewer.SetReportSource(m_Report);
  //设置报表浏览器放大倍数
  m_CtrlReportViewer.Zoom(1);
  //预览报表
  m_CtrlReportViewer.ViewReport();
  //设置报表设计器和报表浏览器的可见性
  if(!m_CtrlReportDesigner.IsWindowVisible())
  {
  m_CtrlReportViewer.ShowWindow(FALSE);
  m_CtrlReportDesigner.ShowWindow(TRUE);
  }
}void CCrystalDlg::OnNewReport() 
{
// TODO: Add your command handler code here
InitReport(TRUE);

}很是不解,编译连接都没有问题,最后运行后出现点击新建,出现 abnormal program termination