Platform :

Popular Solution Go   Back

C# - How to use VideoCap Pro ActiveX on Windows Form and release memory

Step 1: Download VideoCap Pro ActiveX installer and installed it.

Step 2: Create c# project and drag the VideoCap Pro ActiveX on form.

Step 3: Download this sample project.  In form load event, read the audioinputpins object and call start method.

for (int i = 0; i < axVideoCap1.AudioInputPins.Count; i )
{
   String temp = axVideoCap1.AudioInputPins.FindInputPinName((short)(i));
   Console.WriteLine(temp);
}

axVideoCap1.Start();

Step 4: In form close event, you need release audioinputpins and videocap activex. If you called AudioDevices object, you should release it.

  axVideoCap1.Stop();
  axVideoCap1.Unload();
  ReleaseAllCom(axVideoCap1.AudioInputPins);
  axVideoCap1.Dispose();

private void ReleaseAllCom(object o)
{
            int i;
            for (i = 0; i < 100; i )
            {
                int val = Marshal.ReleaseComObject(o);
                if (val == 0)
                {
                    break;
                }
            }


}