public void DesktopLoad(Object sender, EventArgs e) { try { int taskWidth = com.Config.GetConfigAsInt32("Taskbar", "Width"), taskHeight = com.Config.GetConfigAsInt32("Taskbar", "Height"); panTaskBar.BackgroundImage = com.prepareImage(com.toSystemPath(com.Config.GetConfig("Taskbar", "BackgroundImg").Setting)); panTaskBar.BackColor = com.convertColour(com.Config.GetConfig("Colors", "ButtonFace").Setting); panTaskBar.Height = taskHeight; if (taskWidth == -1) { panTaskBar.Dock = DockStyle.Bottom; } else { panTaskBar.Dock = DockStyle.None; panTaskBar.Width = taskWidth; } panTaskBar.Location = new Point((int)((Width / (Double)2) - (taskWidth / (Double)2)), Height - taskHeight); elvDesktop.UpdateDesktop = false; MenuSeup(); if (com.Config.GetConfig("Desktop", "TileWallpaper").Setting == "1") { elvDesktop.WallpaperLayout = ImageLayout.Tile; } else { elvDesktop.WallpaperLayout = ImageLayout.Center; } elvDesktop.BackColor = com.convertColour(com.Config.GetConfig("Colors", "Background").Setting); elvDesktop.Wallpaper = (Bitmap)com.prepareImage(com.toSystemPath(com.Config.GetConfig("Desktop", "Wallpaper").Setting)); elvDesktop.Pattern = new Bitmap(getPattern(com.Config.GetConfig("Desktop", "Pattern").Setting), 8, 8); elvDesktop.UpdateDesktop = true; } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
public AppHolder(String exePath, String arguments) : base() { if (!IsDotNetProcess(exePath)) { Console.WriteLine(exePath + " is not a compatable program"); Dispose(); return; } ProcessStartInfo info = new ProcessStartInfo(exePath, arguments); try { info.UseShellExecute = false; info.CreateNoWindow = true; info.RedirectStandardInput = false; info.RedirectStandardOutput = true; info.RedirectStandardError = false; info.WindowStyle = ProcessWindowStyle.Hidden; pro = Process.Start(info); pro.WaitForInputIdle(); pro.Exited += Exited; while (pro.MainWindowHandle == null || pro.MainWindowHandle == IntPtr.Zero) { ; } SetParent(pro.MainWindowHandle, GuestArea.Handle); do { GetClientRect(pro.MainWindowHandle, ref siz); } while (siz.Width == 0 && siz.Height == 0); // WS_POPUP style and add WS_CHILD style const UInt32 WS_POPUP = 0x80000000, WS_CHILD = 0x40000000; uint style = (UInt32)GetWindowLong(pro.MainWindowHandle, -16); //style = (style & ~(WS_POPUP)) | WS_CHILD; SetWindowLong(pro.MainWindowHandle, -16, style); //int GWL_STYLE = (-16); //uint WS_VISIBLE = 0x10000000; //SetWindowLong(pro.MainWindowHandle, GWL_STYLE, WS_VISIBLE); MoveWindow(pro.MainWindowHandle, 0, 0, siz.Width, siz.Height, true); Size = new Size(siz.Width + lefts.Width + rights.Width, siz.Height + programtopbar.Height + bottoms.Height + 0); this.Maximise += Max; this.DoubleBuffered = true; base.Resize += resizing; this.Closing += Exited; //info.WindowStyle = ProcessWindowStyle.Hidden // do { // //ProjectChicagoObjects.modCommunication.Nap(400, false) // SetParent(pro.MainWindowHandle, GuestArea.Handle); // GetClientRect(pro.MainWindowHandle, ref siz); // // MessageBox.Show(siz.ToString) // // Console.WriteLine(siz) // }while ( siz.Width == 0 && siz.Height == 0); // // Console.WriteLine("c") // pro.BeginOutputReadLine(); //MessageBox.Show(Graphics.FromHwnd(pro.MainWindowHandle).DpiX & "," & Graphics.FromHwnd(pro.MainWindowHandle).DpiY) //Size = new Size(siz.Width + lefts.Width + rights.Width, siz.Height + programtopbar.Height + bottoms.Height + 0); //Graphics.FromHwnd(pro.MainWindowHandle).DpiX, Graphics.FromHwnd(pro.MainWindowHandle).DpiY) REMOVE EXTRAS AND SEE IF IT WORKS // SetWindowPos(pro.MainWindowHandle, 0, panGuestMod.PointToScreen(panGuestMod.Location).X, panGuestMod.PointToScreen(panGuestMod.Location).Y, panGuestMod.Width, panGuestMod.Height, 64) //MoveWindow(pro.MainWindowHandle, panGuestMod.PointToScreen(panGuestMod.Location).X, panGuestMod.PointToScreen(panGuestMod.Location).Y, panGuestMod.Width, panGuestMod.Height, true) // Console.WriteLine("Title") Text = pro.MainWindowTitle; TsudaKageyu.IconExtractor i = new TsudaKageyu.IconExtractor(pro.StartInfo.FileName); // in if (i.Count > 0) { programIcon.Image = new Bitmap(i.GetIcon(i.Count - 1).ToBitmap(), 16, 16); } else { programIcon.Image = new Bitmap(com.prepareImage(com.toSystemPath(com.Config.GetConfig("windows", "GenericAppIco").Setting)), 16, 16); // New TsudaKageyu.IconUtil //pro.StartInfo.FileName).ToBitmap } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }