开发者

Application won't end VideoStreams and Exit

开发者 https://www.devze.com 2023-04-09 07:12 出处:网络
I\'ve got an application what\'s working with two video streams. When the form is being closed, it runs this function:

I've got an application what's working with two video streams. When the form is being closed, it runs this function:

private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (Final开发者_C百科VideoDevice.IsRunning) { FinalVideoDevice.Stop(); }
            if (streamMJPEG.IsRunning) { streamMJPEG.Stop(); }
            Application.Exit();
        }

But in reality it doesn't kill the application, only hides the form, but still is seen from TaskManager/Processes.

Any ideas what I might be doing wrong?

Thanks!


Assuming you are in Windows Forms you can call Application.ExitThread();

in general one of the reasons why you still see the process in TaskManager could be that you still have some background / worker threads active.

Roger check this question/answers as well: Application.Exit

0

精彩评论

暂无评论...
验证码 换一张
取 消