| View previous topic :: View next topic |
| Author |
Message |
Tybobobo Cheater
Reputation: 0
Joined: 24 May 2016 Posts: 25
|
Posted: Wed May 25, 2016 4:07 pm Post subject: How to C# In-game overlay for Trainers? |
|
|
I am trying to figure out how it is possible to create a C# Program that gives you an in-game overlay that displays some cheat options.
I have made trainers using C# Window Applications, but I am interested learning more and finding out how to create in-game overlays where I can display various options, such as "Unlimited Health: Enabled" just so the user wont have to minimize the game in order to see the trainer status/options.
Any and all help will be much appreciated - especially if it points me in the right direction
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed May 25, 2016 7:51 pm Post subject: |
|
|
Create a transparent layered window that is top-most.
You can set those properties via SetWindowLongPtr using:
- GWL_EXSTYLE
- WS_EX_COMPOSITED | WS_EX_TRANSPARENT | WS_EX_LAYERED
In C# you will also need to enforce user drawing and paint the form yourself for proper overlaying. You can do that via:
| Code: | this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
|
Every so often you can find the window you are trying to draw over and reposition your overlay as needed etc.
On newer systems (Windows Vista and higher) the Dwm API will be of interest as well to deal with various window sizes / Aero effects:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa969512(v=vs.85).aspx
_________________
- Retired. |
|
| Back to top |
|
 |
Tybobobo Cheater
Reputation: 0
Joined: 24 May 2016 Posts: 25
|
Posted: Wed May 25, 2016 11:14 pm Post subject: |
|
|
| atom0s wrote: | Create a transparent layered window that is top-most.
You can set those properties via SetWindowLongPtr using:
- GWL_EXSTYLE
- WS_EX_COMPOSITED | WS_EX_TRANSPARENT | WS_EX_LAYERED
In C# you will also need to enforce user drawing and paint the form yourself for proper overlaying. You can do that via:
| Code: | this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
|
Every so often you can find the window you are trying to draw over and reposition your overlay as needed etc.
On newer systems (Windows Vista and higher) the Dwm API will be of interest as well to deal with various window sizes / Aero effects:
|
As I understand it; this will only work when playing in Windowed mode; otherwise I would need... injection or something? Read that I might have to use DirectX or something. Unsure about the specifics. :X
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu May 26, 2016 1:44 am Post subject: |
|
|
Yes, an overlay like this will only work on Windowed Mode / Fullscreen Windowed Mode games.
If you want to render things in the game, that's not really considered an overlay then. You'll have to either hook the rendering engine being used (OpenGL/Direct3D/etc.) or hook the games engine and use its own functions to draw things etc.
_________________
- Retired. |
|
| Back to top |
|
 |
|