提示画像ですがこれはyoutube-dlでダウンロード可能なファイル形式を表示させているのですがこの画面に表示されている文字列をC#側で取得してプルダウンで画質等を選択出来るようにしたいのですがこれをするにはどうやるのでしょうか?
参考サイトの p.StandardOutput.ReadToEnd();関数でStandardOutputが存在しないと言われるのでがこれはなぜでしょうか?
参考サイト:https://atmarkit.itmedia.co.jp/ait/articles/0710/11/news123.html
C#
1namespace YoutubeDownloader 2{ 3 using System.Diagnostics; 4 using System; 5 using System.IO; 6 using System.Diagnostics; 7 8 9 public partial class Form1 : Form 10 { 11 ProcessStartInfo process = new ProcessStartInfo(); 12 13 [System.Runtime.InteropServices.DllImport("kernel32.dll")] 14 private static extern bool AllocConsole(); 15 16 public Form1() 17 { 18 InitializeComponent(); 19 } 20 21 private void Form1_Load(object sender, EventArgs e) 22 { 23 process.FileName = @"youtube-dl.exe"; // 実行するファイル 24 //psInfo.CreateNoWindow = true; // コンソール・ウィンドウを開かない 25 //psInfo.UseShellExecute = false; // シェル機能を使用しない 26 } 27 28 private void textBox1_TextChanged(object sender, EventArgs e) 29 { 30 31 } 32 33 private void button1_Click(object sender, EventArgs e) 34 { 35 process.Arguments = " -h"; 36 37 38 Process.Start(process); 39 40 //string results = 41 42 MessageBox.Show(results); 43 } 44 } 45}
回答1件
あなたの回答
tips
プレビュー