vc调试问题
我调试时出现下列问题,难解决啊,请各位大虾指点:
MoviePlayView.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw3
MoviePlayView.obj : error LNK2001: unresolved external symbol _CLSID_DirectDrawFactory
MoviePlayView.obj : error LNK2001: unresolved external symbol _IID_IDirectDrawFactory
Debug/MoviePlay.exe : fatal error LNK1120: 3 unresolved externals
源代码在这里:
HRESULT CMovieView::InitDDrawEx()
{
HRESULT hr=NOERROR;
DDSURFACEDESC ddsd, ddsd2, ddsd3;
CoInitialize(NULL);
//Create a DirectDrawFactory object
hr = CoCreateInstance(
CLSID_DirectDrawFactory, NULL, CLSCTX_INPROC_SERVER,
IID_IDirectDrawFactory, (void **)&m_pDDF);
if (FAILED(hr))
{
AfxMessageBox(_T("Couldn't create DirectDrawFactory"));
return E_FAIL;
}
//Call the IDirectDrawFactory::CreateDirectDraw method to create the
//DirectDraw object, set the cooperative level, and get the address
//of an IDirectDraw interface pointer
hr = (m_pDDF->CreateDirectDraw(NULL, ::GetDesktopWindow(), DDSCL_NORMAL,
NULL, NULL, &m_pDD));
if (FAILED(hr))
{
AfxMessageBox(_T("Couldn't create DirectDraw object"));
return E_FAIL;
}
//Now query for the new IDirectDraw3 interface
hr =(m_pDD->QueryInterface(IID_IDirectDraw3, (LPVOID*)&m_pDD3));
if (FAILED(hr))
{
AfxMessageBox(_T("Couldn't get IDirectDraw3"));
return E_FAIL;
}
//Initialize the DDSURFACEDESC structure for the primary surface
::ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hr = m_pDD3->CreateSurface(&ddsd, &m_pPrimarySurface, NULL);
if(FAILED(hr))
{
AfxMessageBox(_T("Couldn't create Primary Surface"));
return E_FAIL;
}
// Now, do the same for the offscreen surfaces.
// The offscreen surface needs to use the same pixel format as the primary.
// Query the primary surface to for its pixel format.
hr = m_pPrimarySurface->GetSurfaceDesc(&ddsd);
if(FAILED(hr))
{
AfxMessageBox(_T("Couldn't GetSurfaceDesc"));
return E_FAIL;
}
// Now, set the info for the offscreen surface #1, using the primary's pixel format.
::ZeroMemory(&ddsd2, sizeof(ddsd2));
ddsd2.dwSize = sizeof(ddsd2);
ddsd2.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd2.dwHeight = ddsd.dwHeight; //set the height of the surfaces equal
ddsd2.dwWidth = ddsd.dwWidth; //set the width of the surfaces equal
ddsd2.ddpfPixelFormat = ddsd.ddpfPixelFormat; //set the pixel formats equal
// Now, create the offscreen surface #1 and query for the latest interface.
hr = m_pDD3->CreateSurface(&ddsd2, &m_pDDSOffscreen, NULL);
if(FAILED(hr))
{
AfxMessageBox(_T("Couldn't create Offscreen Surface"));
return E_FAIL;
}
// Now, set the info for the offscreen surface #2, using the primary's pixel format.
::ZeroMemory(&ddsd3, sizeof(ddsd3));
ddsd3.dwSize = sizeof(ddsd3);
ddsd3.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
ddsd3.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd3.dwHeight = ddsd.dwHeight; //set the height of the surfaces equal
ddsd3.dwWidth = ddsd.dwWidth; //set the width of the surfaces equal
ddsd3.ddpfPixelFormat = ddsd.ddpfPixelFormat; //set the pixel formats equal
// Now, create the offscreen surface #2 and query for the latest interface.
hr = m_pDD3->CreateSurface(&ddsd3, &m_pDDSOffscreen2, NULL);
if(FAILED(hr))
{
AfxMessageBox(_T("Couldn't create Offscreen Surface2"));
return E_FAIL;
}
//Add code for Clipper
hr = m_pDD3->CreateClipper(0, &m_pDDClipper, NULL);
if(FAILED(hr))
{
AfxMessageBox(_T("Couldn't create Clipper"));
return E_FAIL;
}
hr = m_pPrimarySurface->SetClipper(m_pDDClipper);
if(FAILED(hr))
{
AfxMessageBox(_T("Call to SetClipper failed"));
return E_FAIL;
}
hr = m_pDDClipper->SetHWnd(0, AfxGetMainWnd()->m_hWnd);
if(FAILED(hr))
{
AfxMessageBox(_T("Call to SetHWnd failed"));
return E_FAIL;
}
return NOERROR;
}