public void DrawWindow() { Program.GDIOverlay.FormBorderStyle = FormBorderStyle.None; Program.GDIOverlay.BackColor = Color.FromArgb(00, 255, 00); Program.GDIOverlay.TransparencyKey = Color.FromArgb(00, 255, 00); Program.GDIOverlay.Show(); int InitialStyle = WinAPIComponents.GetWindowLong(Program.GDIOverlay.Handle, -20); // Get the window style // WinAPIComponents.SetWindowLong(Program.GDIOverlay.Handle, -20, InitialStyle | 0x80000 | 0x20); // Set window properties | Window is now clickthrough! // This is now redundant! WinAPIComponents.GetWindowRect(HeroesHandle, out HeroesWindowRectangle); // Get window rectangle Program.GDIOverlay.TopMost = true; // Put to top. AdjustOverlayWindow(); // Listen for sizechange change changes across all processes/threads on current desktop... IntPtr HeroesHook = WinAPIComponents.SetWinEventHook(WinAPIComponents.EVENT_OBJECT_LOCATIONCHANGE, WinAPIComponents.EVENT_OBJECT_LOCATIONCHANGE, IntPtr.Zero, WinAPIComponents.procDelegate, 0, 0, WinAPIComponents.WINEVENT_OUTOFCONTEXT); // Now put this window on that fake borderspace window! SetWindowParent(); Program.OpenedForms.Add(Program.GDIOverlay); Program.xSmallMainWindow.Location = new Point(0, 0); Program.xSmallMainWindow.WarpUtilitiesMenu.WarpInformationOverlay.Location = new Point(0, 0); Program.xSmallMainWindow.OptionsMenu.TinyUI_Nud_OverlayOpacity.Enabled = true; Program.xSmallMainWindow.OptionsMenu.TinyUI_Nud_OverlayOpacity.Value = Program.xSmallMainWindow.OptionsMenu.TinyUI_Nud_Opacity.Value; Program.xSmallMainWindow.OptionsMenu.TinyUI_Nud_Opacity.Value = 1; Program.xSmallMainWindow.OptionsMenu.TinyUI_Nud_Opacity.Enabled = false; }
public void HookTheGame(object sender, EventArgs e) { if (GameProcess == null) { try { // Game Process GameProcess = new MemorySharp(ApplicationFinder.FromProcessName("Tsonic_win").First()); // If the first doesn't successfully happen this will never be hit HeroesHandle = WinAPIComponents.FindWindow(null, HEROES_WINDOW_NAME); Program.xSmallMainWindow.Invoke(new MethodInvoker(WriteGameIsHookedText)); Program.xSmallMainWindow.Invoke(new MethodInvoker(DrawWindow)); } catch { Program.xSmallMainWindow.Invoke(new MethodInvoker(WriteWaitingForGameText)); } } else if (GameProcess.IsRunning == false) { try { // Game Process GameProcess = new MemorySharp(ApplicationFinder.FromProcessName("Tsonic_win").First()); // If the first doesn't successfully happen this will never be hit HeroesHandle = WinAPIComponents.FindWindow(null, HEROES_WINDOW_NAME); Program.xSmallMainWindow.Invoke(new MethodInvoker(WriteGameIsHookedText)); Program.xSmallMainWindow.Invoke(new MethodInvoker(DrawWindow)); } catch { Program.xSmallMainWindow.Invoke(new MethodInvoker(WriteWaitingForGameText)); } } }
/// This allows for the window to be moved without having a real border! private void Panel_TitleBar_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { WinAPIComponents.ReleaseCapture(); WinAPIComponents.SendMessage(Handle, WinAPIComponents.WM_NCLBUTTONDOWN, WinAPIComponents.HT_CAPTION, 0); } }
private void ThemeMDIClients() { foreach (MdiClient Control in this.Controls.OfType <MdiClient>()) { // Set the BackColor of the MdiClient control. Control.BackColor = this.BackColor; WinAPIComponents.SetBevel(this, false); } }
// Allow for dragging around of the form. private void MainFormSmall_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { WinAPIComponents.ReleaseCapture(); WinAPIComponents.SendMessage(Handle, WinAPIComponents.WM_NCLBUTTONDOWN, WinAPIComponents.HT_CAPTION, 0); this.Invalidate(); Program.GDIOverlay.Invalidate(); } }
public void SetWindowParent() { IntPtr FormHandleID = Program.xSmallMainWindow.Handle; IntPtr OverlayWindowHandleID = Program.GDIOverlay.Handle; WinAPIComponents.SetParentX(FormHandleID, OverlayWindowHandleID); IntPtr WarpMenuInformationHandleID = Program.xSmallMainWindow.WarpUtilitiesMenu.WarpInformationOverlay.Handle; WinAPIComponents.SetParentX(WarpMenuInformationHandleID, OverlayWindowHandleID); Program.xSmallMainWindow.TopMost = true; }
static void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { // filter out non-HWND namechanges... (eg. items within a listbox) if (idObject != 0 || idChild != 0) { return; } // Adjust Size Accordingly WinAPIComponents.GetWindowRect(GameHook.HeroesHandle, out GameHook.HeroesWindowRectangle); // Get rectangle int WindowWidth = GameHook.HeroesWindowRectangle.RightBorder - GameHook.HeroesWindowRectangle.LeftBorder; int WindowHeight = GameHook.HeroesWindowRectangle.BottomBorder - GameHook.HeroesWindowRectangle.TopBorder; Program.GDIOverlay.Size = new Size(WindowWidth, WindowHeight); Program.GDIOverlay.Top = GameHook.HeroesWindowRectangle.TopBorder; Program.GDIOverlay.Left = GameHook.HeroesWindowRectangle.LeftBorder; }
public void InitializeSystem() { Toolstrip_Bottom.Renderer = new MyToolStrip(); // Do not draw an outline on toolstrips! this.Region = System.Drawing.Region.FromHrgn(WinAPIComponents.CreateRoundRectRgn(0, 0, this.Width, this.Height, 30, 30)); // Rounded edges! Program.xFonts.SetupMainWindow(this); // Call SetupFonts in xFonts object. ButtonColour = Color.FromArgb(232, 234, 246); // Set the button default colour to the background colour of the light control buttons. /// Set local theme overrides! RedirectThemeValues(); // Must preceede following. ThemeMethods.DoThemeAssets(this); // Automatically theme assets! SetupSwappableScreens(); // If using Swappable forms! ThemeMethods.AutoLoadCurrentTheme(); // Automatically theme the world! SplashLoader.xSetPercentage(100); SplashLoader.UpdateStatusCircleComplete = true; }