question

MuhammadAsadAshraf-1585 avatar image
0 Votes"
MuhammadAsadAshraf-1585 asked DanielZhang-MSFT edited

FilgraphManagerClass Freeze in windows Form Application

My Windows form Application got freeze while creating an instance of FilgraphmanagerClass

The problem occurs when I click menubar on the picture box panel and when the video trying to start it tries to create an instance of FilgraphManagerClass and got stuck.

I tried to create an instance using thread and background worker but nothing is working

windows-forms
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This old sample still works fine on my Windows 10 OS
But you can also do it without FilgraphManager by declaring IGraphBuilder and other interfaces with P/Invoke




0 Votes 0 ·

Thanks for this reference
Cleanup method code solves this problem of freezing but it also closes my menubar open on the picture box
Is there any workaround on this problem

    private void CleanUp()
     {
         if (m_objMediaControl != null)
             m_objMediaControl.Stop();

         m_CurrentStatus = MediaStatus.Stopped;

         if (m_objMediaEventEx != null)
             m_objMediaEventEx.SetNotifyWindow(0, 0, 0);

         if (m_objVideoWindow != null)
         {
             m_objVideoWindow.Visible = 0;
             m_objVideoWindow.Owner = 0;
         }


0 Votes 0 ·

Hi MuhammadAsadAshraf,
According to your description, I can't reproduce the situation. What goes on in this constructor of FilgraphManagerClass? And it may freeze the main thread.
So in order to find the problem more accurately, please provide some relevant code.
You can also use async await to prevent winform application from freezing.
Here is a code example in this link you can refer to.
Best Regards,
Daniel Zhang


0 Votes 0 ·

17402-image.png



Please see the image of code got freeze when i open menubar on Video panel

0 Votes 0 ·
image.png (139.7 KiB)

17280-image.png



The code for instance call from here

0 Votes 0 ·
image.png (33.9 KiB)
Show more comments

0 Answers