From 5d76fbffa34c378e842f4495b9c0606f5aa8953d Mon Sep 17 00:00:00 2001 From: Igor Hernandez Date: Thu, 18 Aug 2011 17:07:48 -0400 Subject: [PATCH] Transparent non-clickthroughable form thanks to EveCodeJunkie --- UI/ClientWindow.cs | 4 ++-- UI/WindowHandler.cs | 21 +++++---------------- Util/DrawableScreen.cs | 15 ++++++++++----- Util/Utils.cs | 10 ++++++++++ app.config | 4 ++-- 5 files changed, 29 insertions(+), 25 deletions(-) diff --git a/UI/ClientWindow.cs b/UI/ClientWindow.cs index becb46f..c8ca4a6 100644 --- a/UI/ClientWindow.cs +++ b/UI/ClientWindow.cs @@ -128,14 +128,14 @@ private void mouseInput_Click(object sender, System.EventArgs e) Console.WriteLine("Stopping Input"); mouseInput.Text = "Input"; - this.Invalidate(); + //this.Invalidate(); } else { Console.WriteLine("Starting Input"); mouseInput.Text = "No Input"; - this.Invalidate(); + //this.Invalidate(); } isMouse = !isMouse; } diff --git a/UI/WindowHandler.cs b/UI/WindowHandler.cs index 6548b75..53045fa 100644 --- a/UI/WindowHandler.cs +++ b/UI/WindowHandler.cs @@ -304,7 +304,6 @@ public WindowHandler(ClientWindow cw) dll = items[1]; drawingScreen = new DrawableScreen(cw, this); - //drawingScreen = new Utils(); pipename = RandomString(9); pipename = "\\\\.\\pipe\\" + pipename; com = new Communicator(pipename); @@ -627,6 +626,8 @@ private void initialize() pmouse.setWindowHandle(appWin); keyboard.setWindowHandle(appWin); mouse.setWindowHandle(appWin); + //drawingScreen.TopLevel = false; + //drawingScreen.Parent = this; StringBuilder sb = new StringBuilder(300); @@ -837,8 +838,6 @@ protected override void OnVisibleChanged(EventArgs e) //this.Invalidate(); base.OnVisibleChanged(e); - - } /// @@ -868,18 +867,7 @@ protected override void OnHandleDestroyed(EventArgs e) } - protected override void OnPaint(PaintEventArgs e) - { - if (loaded) - { - //drawingScreen.Invalidate(); - drawingScreen.drawString("Eryan 2.0", systemFont, new Point(0, 0)); - } - - - base.OnPaint(e); - } - + /// /// Update the drawing screen /// @@ -909,12 +897,13 @@ private void handleDrawingScreen() drawingScreen.setOwner(this); + //drawingScreen.bringToFront(); drawingScreen.setSize(new Size(this.Size.Width, this.Size.Height)); drawingScreen.setLocation(new Point(cw.Location.X+10, cw.Location.Y+80)); //drawingScreen.setLocation(new Point(this.Location.X+5, this.Location.Y + 50)); //drawingScreen.setBackColor(Color.Transparent); drawingScreen.setBackColor(Color.Gray); - drawingScreen.setOpacity(0.70); + //drawingScreen.setOpacity(0.70); //drawingScreen.setTransparencyKey(); drawingScreen.setFormBorderStyle(FormBorderStyle.None); drawingScreen.setControlBox(false); diff --git a/Util/DrawableScreen.cs b/Util/DrawableScreen.cs index bab2907..05493c3 100644 --- a/Util/DrawableScreen.cs +++ b/Util/DrawableScreen.cs @@ -13,20 +13,19 @@ namespace Eryan.Util { - /// - /// The Eryan overlay, for internal use - /// - + + public class DrawableScreen : Utils { - WindowHandler wh; ClientWindow cw; PreciseMouse pm; KeyBoard kb; Mouse m; + private Font systemFont = new Font("Impact", 16); + [DllImport(@"C:\\mouseDLL.dll")] public static extern void dllMoveMouse(IntPtr handle, int x, int y); @@ -37,6 +36,12 @@ public DrawableScreen(ClientWindow cw, WindowHandler wh) : base() this.cw = cw; } + protected override void OnPaint(PaintEventArgs e) + { + drawString("Eryan 2.0", systemFont, new Point(20, 50)); + //base.OnPaint(e); + } + protected override void OnMouseMove(MouseEventArgs e) { //cw.tabControl1.Invalidate(); diff --git a/Util/Utils.cs b/Util/Utils.cs index 7ca1ede..2e44510 100644 --- a/Util/Utils.cs +++ b/Util/Utils.cs @@ -55,6 +55,16 @@ public virtual uint getPid() return pid; } + protected override CreateParams CreateParams + { + get + { + // Set the WS_EX_TRANSPARENT flag without enabling click-through + CreateParams createParams = base.CreateParams; + createParams.ExStyle |= 0x00000020; + return createParams; + } + } public void drawString(String str, Font f, Point loc, bool antialiasing) { diff --git a/app.config b/app.config index 49cc43e..aa8af7a 100644 --- a/app.config +++ b/app.config @@ -1,3 +1,3 @@ - + - \ No newline at end of file +