3

I am a new programmer using Visual Studio 2008. How can I add an reference to QuartzTypeLib. I have already checked the add reference folder and do not see a library for Quartz in the .net or com reference library. When trying to compile code I am receiving an error that states missing assembly reference.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuartzTypeLib;

namespace DirectShowCsharp
{
    class Program
    {
        static void Main(string[] args)
        {

       }
    }
}
Kehlin Swain
  • 481
  • 1
  • 4
  • 13

3 Answers3

1

There is a complete solution that uses QuartzTypeLib to play videos.

Player

DirectShow MediaPlayer in C#

The relevant part of the source code is:

using QuartzTypeLib;

FilgraphManager FilterGraph = new FilgraphManager();
FilterGraph.RenderFile("test.mp3");
FilterGraph.Run();
// ...
FilterGraph.Stop();
sɐunıɔןɐqɐp
  • 3,332
  • 15
  • 36
  • 40
Mohamad Shiralizadeh
  • 8,329
  • 6
  • 58
  • 93
1

AFAIK, DirectShow is considered as obsolete by Microsoft, probably this is the reason for not including this assembly into the latest Visual Studio.

I don't know how to automate the 1st action, but it is needed only once before the first build.

  1. Run tlbimp tool (in your case path will be different):

    "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\TlbImp.exe" %windir%\system32\quartz.dll /out:QuartzTypeLib.dll

  2. Add generated QuartzTypeLib.dll as a COM-reference to your project (click right mouse button on the project name in "Solution Explorer", then select "Add" menu item and then "Reference")

  3. In your Project, expand the "References", find the QuartzTypeLib reference. Right click it and select properties, and change "Embed Interop Types" to false. (Otherwise you won't be able to use the FilgraphManagerClass in your project (and probably a couple of other ones)).

Vlad
  • 87
  • 1
  • 4
  • This answer worked for me. And I could only make QuartzTypeLib.dll 's `FilterGraph.RenderFile()` work properly by disabling the `Prefer 32-bit` option in my project settings, otherwise I get the Exception: `System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80040266` – sɐunıɔןɐqɐp Oct 02 '19 at 23:51
0

In add reference select Browse on left and then select browse in the right down corner and browse to the location of your library .

niceman
  • 2,653
  • 29
  • 57