Menu

Error on DxLogoVB

Alex
2005-09-13
2012-10-29
  • Alex

    Alex - 2005-09-13

    Well i was trying to run the DxLogoVB Example, and sadly it didn't want to run.

    It is throwing and Invalid Cast Exception Inside SetConfigParams, specificlly on the following line of code:

        Dim videoControl As IAMVideoControl = DirectCast(capFilter, IAMVideoControl)
    

    I'm just going trough the code, and i'm still kind of cluless on the class ( going trough examples and MSDN Directshow ) can someone tell me what is wrong here??

    Thanks.
    Alex.

     
    • Gordon

      Gordon - 2005-09-14

      This happens to me too, but then I realized I don't have a video capture device connected on my PC. I think the exception is being thrown because the call to IAMVideoControl is failing.

       
      • snarfle

        snarfle - 2005-09-15

        That's odd.

        I would expect that if you have no capture device, it would throw a "No video capture devices found at that index!" exception well before you get down to the DirectCast statement this person refers to.

         
    • Gordon

      Gordon - 2005-09-16

      I ran into this myself. I have a capture driver installed but no capture device connected. My system will show the driver, so it'll pass the first test. Without a physical device connected to it, the code will fail. The C# version of DXLogo does the same thing for me.

       
    • amy

      amy - 2005-09-16

      I am having the same problem. I did not change anything of the code.

      I have the actual capture device on.

      If I remove the next line (DsError.Throw...), the code can work. But now I need to change the size of the captured pictures. I do not know what is wrong with this part.

       
    • amy

      amy - 2005-09-19

      Thanks for your reply.

      I used the size 640x480, but it did not work. SetFormat(media) failed. And the error is "unspecified".
      I have a question about the v.VmiHeader ---- should I change ImageSize property manually if I change the picture size? is it right for this value stay at 230400? It seems the media also has such a size property at value 230400...

       
    • amy

      amy - 2005-09-19

      Again, just ignore my last msg.

      I ran the dumpvcap and found only one pin "Still" (other 2 pins are "Capture" and "Preview") support 640x480.

      Then I changed all "PinCategory.Capture" to "PinCategory.Still", but the avi file cannot be played.

      Can you tell me how can I change the pin to "Still" to capture vedio?

      Thanks.

       
      • snarfle

        snarfle - 2005-09-20

        The "still" pin is for taking snapshots. I doubt you can capture video from it. It is not uncommon for "still" pins to have higher resolutions than capture pins (which DO support video).

        For taking snapshots, see the DxSnap sample.

         
        • Alex

          Alex - 2005-10-10

          Well as i read on one of your answers on another post you said that the best way to set the size of the video output was following the example of SetConfigParms in the DxLogo, as you probably know by now i'm working on VB.net and the example was failing in this line:
          It is throwing and Invalid Cast Exception Inside SetConfigParams, specificlly on the following line of code:
          Dim videoControl As IAMVideoControl = DirectCast(capFilter, IAMVideoControl)

          giving an invalid cast, i already tried using ctype, but didn't work either, the only workaround i found by now is i created a small Class Project in C# where i copied the SetConfigParms from DxLogo C# and it worked just fine. so for now if someone needs to have that function working on a Vb.net project my best advice will be create a small project in C# and call that specific C# function from vb.net

          Alex.

           
    • snarfle

      snarfle - 2005-09-13

      Well that's odd.

      Using DirectCast like this is VB's way of doing QueryInterface. This sounds like the device you are running against doesn't support the IAMVideoControl interface. Are you using the unmodified source? Or have you changed anything?

      You could try changing the DirectCast to CType.

       
    • amy

      amy - 2005-09-16

      Sorry, the error here is different from the above.
      I run this program several times, but exception occurs when (different place at different time) --

      DsError.ThrowExceptionForHR(hr)

      hr became -2147467259.

      I ran once successfully when I comment one ThrowException, but now this exception happens somewhere else again!

      How can I solve the problem please?

       
      • amy

        amy - 2005-09-16

        Very sorry.
        I ve tried to delete my msgs but failed.
        I checked again and found the exception is throwed because I changed the size of width and height of the vedio.

        Now I am wondering whehter I can use different sizes for the same capture device? or I need to zoom in or out to the proper size after the capture?

         
        • snarfle

          snarfle - 2005-09-18

          The forum doesn't allow for the deletion of messages.

          Video devices commonly support different output sizes, but usually only from a specific list of sizes (ie you probably can't set the size to 123 x 456, but 320x240, 640 x 480 etc will work).

          To find out what video resolutions your device supports, you can walk the capabilities returned by IAMStreamConfig. There is a (compiled) c++ program to do that at http://www.LimeGreenSocks.com/DShow named dumpvcap.

           
  • Peter_B

    Peter_B - 2009-09-27

    I know this is an old thread but somebody might need the solution.
    This works for me:

    Dim videoControl As IAMVideoControl = TryCast(capFilter, IAMVideoControl)

    Peter

     

Log in to post a comment.