C#でメディアファイルをウインドウにドロップしたらそのメディアファイルの情報を表示する

このアプリを実行するとウインドウが表示されるので
そこにファイラーなどからメディアファイルをドロップしてください
そうすると、FFmpegのffprobe.exeを利用してその情報をウインドウに表示します

https://www.ffmpeg.org からffmpeg-xxxxxxxx-xxxxxxx-win64-static.zip をダウンロードして
その中にある ffprobe.exe をこのアプリと同じディレクトリに入れておいてください
(64bit版の場合、このアプリを管理者権限で実行してしまうと、管理者権限で実行中の物からしかドロップできませんので注意)


csc.exe -target:winexe mediafile_probe.cs

みたいな感じでコンパイルすればコマンドプロンプトは開きません

あと、フォントに「Yu Gothic UI」を指定してるので無い環境の場合は違うフォントを指定してください

using A_Console          = System.Console;
using A_Forms            = System.Windows.Forms;
using A_Application      = System.Windows.Forms.Application;
using A_DataFormats      = System.Windows.Forms.DataFormats;
using A_DragDropEffects  = System.Windows.Forms.DragDropEffects;
using A_DragEventArgs    = System.Windows.Forms.DragEventArgs;
using A_DragEventHandler = System.Windows.Forms.DragEventHandler;
using A_FormBorderStyle  = System.Windows.Forms.FormBorderStyle;
using A_MessageBox       = System.Windows.Forms.MessageBox;
using A_ScrollBars       = System.Windows.Forms.ScrollBars;
using A_TextBox          = System.Windows.Forms.TextBox;
using A_Process          = System.Diagnostics.Process;
using A_ProcessStartInfo = System.Diagnostics.ProcessStartInfo;
using A_Encoding         = System.Text.Encoding;
using A_Font             = System.Drawing.Font;
using A_FontStyle        = System.Drawing.FontStyle;
using A_GraphicsUnit     = System.Drawing.GraphicsUnit;
using A_Point            = System.Drawing.Point;
using A_Size             = System.Drawing.Size;

namespace AppMediaFileProbe
{
	public class Form1 : A_Forms.Form
	{
		private A_TextBox txt1;
		public Form1()
		{
			//Form1
			this.Name = "Form1";
			this.Text = "メディア情報解析 by ffprobe";
			this.ClientSize = new A_Size(1600, 800);
			this.FormBorderStyle = A_FormBorderStyle.FixedSingle;
			this.AllowDrop = true;
			this.DragDrop += new A_DragEventHandler(this.Form1_DragDrop);
			this.DragEnter += new A_DragEventHandler(this.Form1_DragEnter);
			//txt1
			this.txt1 = new A_TextBox();
			this.txt1.Name = "txt1";
			this.txt1.Font = new A_Font("Yu Gothic UI", 12F, A_FontStyle.Bold, A_GraphicsUnit.Point, ((byte)(128)));
			this.txt1.Location = new A_Point(5, 5);
			this.txt1.Multiline = true;
			this.txt1.ReadOnly = true;
			this.txt1.ScrollBars = A_ScrollBars.Both;
			this.txt1.Size = new A_Size(1590, 790);
			this.txt1.TabIndex = 1;
			this.Controls.Add(txt1);
		}
		private void Form1_DragDrop(object sender, A_DragEventArgs e)
		{
			string[] files = (string[])e.Data.GetData(A_DataFormats.FileDrop, false);
			txt1.Text = Call_ffprobe(files[0]);
		}
		private void Form1_DragEnter(object sender, A_DragEventArgs e)
		{
			if (e.Data.GetDataPresent(A_DataFormats.FileDrop))
			{
				e.Effect = A_DragDropEffects.Copy;
			}
		}
		private string Call_ffprobe(string file_name)
		{
			A_ProcessStartInfo psi = new A_ProcessStartInfo();
			psi.FileName = @".\ffprobe.exe";
			psi.Arguments = "\"" + file_name + "\"";
			psi.CreateNoWindow = true;
			psi.UseShellExecute = false;
			psi.RedirectStandardError = true;
			psi.StandardErrorEncoding = A_Encoding.UTF8;
			A_Process p = A_Process.Start(psi);
			return p.StandardError.ReadToEnd();
		}
		[System.STAThread]
		static void Main()
		{
			A_Application.EnableVisualStyles();
			A_Application.Run(new Form1());
		}
	}
}