public Component(Dock dock, HarborService harbor, string command, string args = "") { _harbor = harbor; _dock = dock; var psi = new ProcessStartInfo(command) { Arguments = args, }; Process = Process.Start(psi); Process.EnableRaisingEvents = true; Process.Exited += (a,b) => { _dock.Despawn(this); }; Process.WaitForInputIdle(); this.Position(0, 0, 0, 0); SetParent(Process.MainWindowHandle, _harbor.Handle); var style = GetWindowLong(Process.MainWindowHandle, GWL_STYLE); style = style & ~WS_CAPTION & ~WS_THICKFRAME & ~WS_EX_APPWINDOW & ~WS_EX_TOOLWINDOW; SetWindowLong(Process.MainWindowHandle, GWL_STYLE, style); SetWindowLong(Process.MainWindowHandle, -20, (GetWindowLong(Process.MainWindowHandle, -20) | WS_EX_TOOLWINDOW) & ~WS_EX_APPWINDOW); }
public Dock(HarborService harbor) { _harbor = harbor; Components = new HashSet<Component>(); }