none
how to use the function in COM? RRS feed

  • 问题

  • hi,all! :)

     I have a question about how to use the function in COM? For example, when i use the directshow pushsource pushbitmapset filter, as we know ,this is a COM . How can we do to use the fuction inside of the filter? For i have already wirte dll.def which have 

    EXPORTS
                DllMain                       PRIVATE
                DllGetClassObject       PRIVATE
                DllCanUnloadNow        PRIVATE
                DllRegisterServer        PRIVATE
                DllUnregisterServer     PRIVATE

    when I wirte dll.cpp to use the fuction in COM ,i wirte 

     

    STDAPI DllRegisterServer()
    {
    HRESULT hr;
    IFilterMapper2 *pFM2 = NULL;

    hr = AMovieDllRegisterServer2(TRUE);
    if (FAILED(hr))
    return hr;

    hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
    IID_IFilterMapper2, (void **)&pFM2);

    if (FAILED(hr))
    return hr;

    hr = pFM2->RegisterFilter(
    CLSID_PushSourceBitmap, // Filter CLSID. 
    g_wszFilterName, // Filter name.
    NULL, // Device moniker. 
    &CLSID_VideoInputDeviceCategory, // Video compressor category.
    g_wszFilterName, // Instance data.
    &rf2FilterReg // Pointer to filter information.
    );
    --------------------------------------------------------------

    i want to use fuction inside of COM.

    pFM2->....

    but it only export 6 fuction as follow:

    addref(); 

    CreateCategory();

    EnumMatchingFilters();

    QueryInterface();

    RegisterFilter();

    Release();

    UnregisterFilter();

    and i donnot find the right fuction i wanna use inside of the filter COM.

    ---------------------------------------------------

    pFM2->Release();

    return hr;
    }

    Can anyone help with it ? Thanks a lot! 

    2012年2月15日 6:10

答案