Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>MPC-HC WebServer - Variables</title>
- <meta http-equiv="content-type" content="text/html; charset=utf-8">
- <link rel="stylesheet" type="text/css" href="default.css">
- </head>
- <body>
- <p id="filepatharg">C:music.mp3</p>
- <p id="filepath">C:music.mp3</p>
- <p id="filedirarg">C:</p>
- <p id="filedir">C:</p>
- <p id="state">1</p>
- <p id="statestring">Paused</p>
- <p id="position">85918</p>
- <p id="positionstring">00:01:25</p>
- <p id="duration">284525</p>
- <p id="durationstring">00:04:44</p>
- <p id="volumelevel">50</p>
- <p id="muted">0</p>
- <p id="playbackrate">1</p>
- <p id="reloadtime">0</p>
- </body>
- class Program
- {
- public delegate bool WindowEnumDelegate(IntPtr hwnd,
- int lParam);
- [DllImport("user32.dll")]
- public static extern int EnumChildWindows(IntPtr hwnd,
- WindowEnumDelegate del,
- int lParam);
- [DllImport("user32.dll")]
- public static extern int GetWindowText(IntPtr hwnd,
- StringBuilder bld, int size);
- static void Main(string[] args)
- {
- var mainWindowHandle = Process.GetProcessesByName("mpc-hc").First().MainWindowHandle;
- var list = new List<string>();
- EnumChildWindows(mainWindowHandle, (hwnd, param) =>
- {
- var bld = new StringBuilder(256);
- GetWindowText(hwnd, bld, 256);
- var text = bld.ToString();
- if (!string.IsNullOrEmpty(text))
- list.Add(text);
- return true;
- }, 0);
- Console.WriteLine("length={0}", list[0]);
- Console.WriteLine("state={0}", list[1]);
- Console.WriteLine("bitrate={0}", list[5]);
- Console.WriteLine("name={0}", list[7]);
- Console.WriteLine("Press enter to exit");
- Console.ReadLine();
- }
- }
Add Comment
Please, Sign In to add comment