QueryInterface returning undocumented result

This is a discussion on QueryInterface returning undocumented result within the Windows Programming forums, part of the Platform Specific Boards category; Im getting an undocumented return code from a call to IUnknown::QueryInterface. here is the code - Code: hr = CoCreateInstance(CLSID_FilterGraph ...

  1. #1
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189

    QueryInterface returning undocumented result

    Im getting an undocumented return code from a call to IUnknown::QueryInterface.

    here is the code -
    Code:
        hr = CoCreateInstance(CLSID_FilterGraph , NULL , CLSCTX_ALL , IID_IGraphBuilder , (void**)&pGraphBuilder);
    
        hr = pGraphBuilder->QueryInterface(IID_IMediaControl , (void**)pMediaControl);
        switch(hr){
            case S_OK:
                break;
            case E_NOINTERFACE:
            case S_FALSE:
                MessageBox(NULL , "Media Control Interface IID_IMediaControl not supported" , "DirectShow Failure" , MB_OK);
                goto cleanup;
            default:
                MessageBox(NULL , "Some Unknown HRESULT returned" , "Unknown Result" , MB_OK);
                goto cleanup;
            }
    Im getting the messagebox about unkown HRESULT returned. I checked the help file, and MSDN, these are the only values that they say can be returned.
    P.S. I snipped out the error handler for the call to cocreateinstance, its returning S_OK;
    Last edited by abachler; 08-16-2007 at 02:23 PM.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Found the bug,

    Code:
    (void**)pMediaControl
    needed to be
    Code:
    (void**)&pMediaControl
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  3. #3
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,805
    Are you using ATL, cause CComPtrs could help get rid of those gotos. I used to see those dangled around in some code I deal with

  4. #4
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    ATL is just as bloated and worthless as MFC IMO, all those context switches just eat clock cycles. I know alo of programmers find goto's distasteful, and generally I shun them as well, but as long as you remember to avoid inline variable declarations, I dont see any reason to not use them when they can turn an otherwise obfuscated piece of code into something merely kludgey.

    Now it seems I cant get the pins to connect (from the log file)-

    Connect: Trying to connect output pin 3887c to input pin 3c6ec
    Connect: Trying direct connection from output pin 3887c to input pin 3c6ec
    Connect: Could not get a media type from pin 3887c, hr=80040209
    Connect: Indirect connection from Output pin 3887c to input pin 3c6ec FAILED, hr=0x80040209
    Connect: FAILED to connect output pin 3887c to input pin 3c6ec, hr=0x80040209

    The output pin is from a logitech USB camera, so im not sure why I cant get a media type from it. The logitech filter was added to the graph builder, so it should allow at least an indirect connection. I know it can be done because amcap manages to make the link.
    Last edited by abachler; 08-17-2007 at 01:22 PM.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting a swf file in a windows application
    By face_master in forum Windows Programming
    Replies: 12
    Last Post: 05-03-2009, 11:29 AM
  2. Need help with basic calculation program.
    By StateofMind in forum C Programming
    Replies: 18
    Last Post: 03-06-2009, 12:44 AM
  3. Promblem with code
    By watchdogger in forum C Programming
    Replies: 18
    Last Post: 01-31-2009, 05:36 PM
  4. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 04:27 AM
  5. cos() returning wrong result?
    By rmullen3 in forum C++ Programming
    Replies: 6
    Last Post: 08-20-2002, 11:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21