private void chance_option_Click(object sender, EventArgs e) { cmdProcess p = new cmdProcess(); string arguments = "-list_options true -f dshow -i video=\"" + dShow_Name.Text + "\""; p.InitP(arguments); p.ErrorDataReceived += new DataReceivedEventHandler(option_Append); p.Start(); p.BeginErrorReadLine(); p.WaitForExit(); p.Close(); p.Dispose(); }
private void button1_Click(object sender, EventArgs e) { cmdProcess p = new cmdProcess(); string arguments = "-list_devices true -f dshow -i dummy"; p.InitP(arguments); p.ErrorDataReceived += new DataReceivedEventHandler(dShow_Append); p.Start(); //启动线程 p.BeginErrorReadLine(); //开始异步读取 p.WaitForExit(); //阻塞等待进程结束 p.Close(); //关闭进程 p.Dispose(); }