static void Main()
{
int formleftpos = 0;
string[] options;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
#if HIGH_PRIORITY_PROCESS
Process thisproc = Process.GetCurrentProcess();
thisproc.PriorityClass = ProcessPriorityClass.High;
#endif
Thread thisthread = Thread.CurrentThread;
thisthread.Priority = ThreadPriority.Highest;
// HWND of Gluon window
int hwndint;
options = GetCommandLineOption("hwnd");
if (options.Length > 1)
{
// Remember HWND for inter-process communcation
int.TryParse(options[1], out hwndint);
InterProcess.otherhwnd = new IntPtr(hwndint);
}
else
{
// We can't start without knowing the HWND of the other app
return;
}
// Form left position specified?
options = GetCommandLineOption("left");
if (options.Length > 1)
{
int.TryParse(options[1], out formleftpos);
}
// Show a URL?
options = GetCommandLineOption("showurl");
if (options.Length > 1)
{
WebPageDisplayForm f = new WebPageDisplayForm();
f.Left = formleftpos;
f.ShowURL(options[1]);
f.Show();
Application.Run(f);
}
// Play media file?
options = GetCommandLineOption("playmedia");
if (options.Length > 0)
{
MediaPlayerDisplayForm f = new MediaPlayerDisplayForm();
f.Left = formleftpos;
f.Show();
f.WindowState = FormWindowState.Maximized;
if (options.Length > 1)
{
string filename = options[1];
int startpos = 0;
options = GetCommandLineOption("startpos");
if (options.Length > 1)
{
int.TryParse(options[1], out startpos);
}
options = GetCommandLineOption("mux");
if (options.Length > 1)
{
f.SetMuxingFile(options[1]);
}
f.PlayFile(filename, startpos);
}
Application.Run(f);
}
}