我必须将2002年编写的C ++程序迁移到Visual Studio 2012.我收到此错误并且我不知道原因。我尝试了一切,但它不起作用。该项目非常大,但此.h文件仅包含在此cpp:
中// ItemFromWorldSpan.cpp : implementation file
//
#include "stdafx.h"
#include "booking.h"
#include "ItemFromWorldSpan.h"
#include "ItemFromWorldSpanPaxDlg.h"
#include "BookingDlg.h"
#include "BookingPax.h"
#include <MsXml2.h>
#include <afxtempl.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define TP_MSG_TYPE_PNRREQ (WM_USER + 1)
// ItemFromWorldSpan dialog
IMPLEMENT_DYNAMIC(CItemFromWorldSpan, CTPDialog)
CItemFromWorldSpan::CItemFromWorldSpan(CTPBookingModule *pBookingModule,CWnd* pParent /*=NULL*/)
: CTPDialog(CItemFromWorldSpan::IDD, pParent),m_pBookingModule(pBookingModule),m_pBokingDlg((CBookingDlg*)pParent)
{
pPnrs = NULL;
}
CItemFromWorldSpan::~CItemFromWorldSpan()
{
if (pPnrs)
pPnrs = (delete pPnrs,NULL);
}
void CItemFromWorldSpan::DoDataExchange(CDataExchange* pDX)
{
CTPDialog::DoDataExchange(pDX);
DDX_Control(pDX,IDC_LIST_PNR,cPnrList);
DDX_Control(pDX,IDOK,butOk);
DDX_Control(pDX,IDCANCEL,butCancel);
}
BEGIN_MESSAGE_MAP(CItemFromWorldSpan, CTPDialog)
ON_MESSAGE(TP_MSG_TYPE_PNRREQ, OnMessagePNRData)
ON_NOTIFY(NM_DBLCLK,IDC_LIST_PNR,OnNMDblClickFlightList)
END_MESSAGE_MAP()
// ItemFromWorldSpan message handlers
BOOL CItemFromWorldSpan::OnInitDialog()
{
CTPDialog::OnInitDialog();
m_MsgList.SetContext((void*)this);
SetHeaderSize(TP_DLG_HEADSIZE);
SetFooterSize(TP_DLG_FOOTSIZE);
SetWindowText("Collecting Data ...");
cPnrList.SetExtendedStyle(cPnrList.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
cPnrList.InsertColumn(0,"File Name",LVCFMT_LEFT, 100, 1);
cPnrList.InsertColumn(1,"Lead Pax",LVCFMT_LEFT, 100, 2);
cPnrList.InsertColumn(2,"Airline",LVCFMT_LEFT, 100, 3);
CRect rcClient;
cPnrList.GetClientRect(&rcClient);
cPnrList.InsertColumn(3,"Route",LVCFMT_LEFT, rcClient.Width() - 301, 3);
butOk.SetIconType(ICON_OK);
butCancel.SetIconType(ICON_CANCEL);
RequestPNRData();
return TRUE;
}
void CItemFromWorldSpan::RequestPNRData()
{
IXMLDOMDocument2 *pXmlDoc = NULL;
HRESULT hr;
CString str,str1,str2;
try
{
hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER,
IID_IXMLDOMDocument2, (void**)&pXmlDoc);
if(FAILED(hr)||!pXmlDoc)
throw 0;
VARIANT_BOOL ok;
str = "<operation type=\"request\" class=\"fetch\"><crs ident=\"wstair\"><pnrlist/></crs></operation>";
hr = pXmlDoc->loadXML(_bstr_t(str),&ok);
if(FAILED(hr) || (!ok))
throw 0;
SaveXML2file(pXmlDoc,"XML\\WSPNRSRequest.xml");
if (m_MsgList.tp_send_xml(pXmlDoc,TP_MSG_TYPE_PNRREQ)<=0)
{
OutputDebugString("ItemFromWorldSpan: RequestPNRData: Cannot send request to server\n");
throw 0;
}
}
catch(...)
{
}
if(pXmlDoc)
pXmlDoc->Release();
return;
}
LRESULT CItemFromWorldSpan::OnMessagePNRData(WPARAM wParam, LPARAM lParam)
{
CComPtr<IXMLDOMDocument2> pXmlDoc;
pXmlDoc.Attach((IXMLDOMDocument2*)wParam);
CComPtr<IXMLDOMNode> pChildNode;
CString str;
HRESULT hr;
try
{
SaveXML2file(pXmlDoc,"XML\\WSPNRSReply.xml");
if (CheckXMLStatus(pXmlDoc,&str)<=0)
{
str = "There was an error:\n" + str;
MessageBox(str);
throw 1;
}
hr = pXmlDoc->selectSingleNode(CComBSTR(_T("/operation/crs/pnrlist")),&pChildNode);
if (FAILED(hr) || (pChildNode == NULL))
throw 0;
if (pPnrs)
pPnrs = (delete pPnrs,NULL);
pPnrs = new CWsPnrList;
if (pPnrs == NULL)
throw 0;
if (!pPnrs->LoadData(pChildNode))
throw 0;
if (!pPnrs->GetDisplayData(ListDisplayData))
throw 0;
POSITION pos = ListDisplayData.GetHeadPosition();
int i = 0;
while (pos)
{
cPnrList.InsertItem(i,_T(""));
cPnrList.SetItemData(i,reinterpret_cast<DWORD_PTR>(pos));
CPnrDisplayData *pData = ListDisplayData.GetNext(pos);
cPnrList.SetItemText(i,0,pData->FileName);
cPnrList.SetItemText(i,1,pData->LeadPax);
cPnrList.SetItemText(i,2,pData->AirLine);
cPnrList.SetItemText(i,3,pData->Route);
i++;
}
}
catch (...)
{
pXmlDoc.Release();
}
return 0;
}
void CItemFromWorldSpan::OnNMDblClickFlightList(NMHDR *pNotifyStruct, LRESULT *result)
{
POSITION pos = reinterpret_cast<POSITION>(cPnrList.GetItemData(reinterpret_cast<LPNMITEMACTIVATE>(pNotifyStruct)->iItem));
CPnrDisplayData *pData = (pData = NULL,ListDisplayData.GetAt(pos));
if ((pData != NULL) && (pPnrs != NULL))
{
CWsPnr *pPnr = (pPnr = NULL,pPnrs->GetPNR(pData->pnr_pos));
if (pPnr != NULL)
{
CItemFromWorldSpanPaxDlg dlg(pPnr,m_pBokingDlg,this);
dlg.DoModal();
}
}
return;
}
有人可以帮帮我吗?我被卡住了!
答案 0 :(得分:0)
您粘贴的文件此评论位于顶部:// ItemFromWorldSpan.cpp : implementation file
我希望它意味着它实际上是ItemFromWorldSpan.cpp。
但您的错误来自文件:afxtempl.h
不直接包含afxtempl.h,因此您需要找到该标题并查看是否可以识别错误。我注意到你的stdafx.h包含在顶部,这意味着你正在使用预编译的头文件。 afxtempl.h可能包含在那里吗?