IID_MediaControl未声明的标识符

时间:2012-10-14 15:55:35

标签: c++ c directshow linker-errors

我正在使用Visual Studio 2008为Windows Mobile 6.1为我的设备开发SmartDevice Win32 DLL。我必须使用DirectShow并开始复制基本示例。

.h

#pragma once

// Additional Include Directories:
// "C:\Program Files (x86)\Windows Mobile 6 SDK\Smartphone\Include\Armv4i"
#include <dshow.h>

// Included strmiids.lib for CLSID_FilterGraph and IID_IGraphBuilder (.cpp)
#pragma comment(lib, "strmiids.lib")



extern "C" {

    __declspec(dllexport) bool InitCOM();

}

.cpp

#include "stdafx.h"
#include "DLLDevice.h"


BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
                     )
{
    return TRUE;
}



__declspec(dllexport) bool InitCOM()
{
    if(FAILED(CoInitialize(NULL)))
        return false;

    IGraphBuilder* pGraphBuilder = NULL;
    HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, 
        IID_IGraphBuilder, (void**) &pGraphBuilder);

    if(FAILED(hr))
        return false;

    IMediaControl *pMediaControl = NULL;
    hr = pGraphBuilder->QueryInterface(IID_MediaControl, (void**) &pMediaControl);


    pGraphBuilder->Release();

    return true;
}

现在我有一个链接器错误:

error C2065: 'IID_MediaControl' : undeclared identifier

为什么呢?我该如何解决这个问题呢? 为什么不能用DirectShow创建项目?

1 个答案:

答案 0 :(得分:2)

因为它是IID_IMediaControl,而不是IID_MediaControl