Answered How to Close Graphics Window? (Drawing.Graphics)

rex64

Member
Joined
Jul 31, 2020
Messages
14
Programming Experience
10+
I am trying to figure out how to leave the class initialized but to return the code back to the calling function. I am calling a Drawing.Graphics window from a WinForms form.


I tried a few of these 1 at a time but they did not help:
C#:
    _window.Dispose();
    System.Windows.Forms.Application.ExitThread();
    System.Environment.Exit(Convert.ToInt32(unlockedPopup));
    return -1;



    #region Assembly GameOverlay, Version=4.3.0.0, Culture=neutral, PublicKeyToken=null
    // C:\Users\Jeff\Documents\Visual Studio 2010\Projects\StudyxMain\StudyxMain\packages\GameOverlay.Net.4.3.0\lib\net45\GameOverlay.dll
    #endregion
  
    using System;
    using GameOverlay.Drawing;
  
    namespace GameOverlay.Windows
    {
        //
        // Summary:
        //     Represents an OverlayWindow which is used to draw at any given frame rate.
        public class GraphicsWindow : OverlayWindow
        {
            //
            // Summary:
            //     Initializes a new GraphicsWindow.
            //
            // Parameters:
            //   device:
            //     Optionally specify a Graphics device to use.
            public GraphicsWindow(Graphics device = null);
            //
            // Summary:
            //     Initializes a new GraphicsWindow with the specified window position and size.
            //
            // Parameters:
            //   x:
            //     The window position on the X-Axis.
            //
            //   y:
            //     The window position on the Y-Axis.
            //
            //   width:
            //     The width of the window.
            //
            //   height:
            //     The height of the window.
            //
            //   device:
            //     Optionally specify a Graphics device to use.
            public GraphicsWindow(int x, int y, int width, int height, Graphics device = null);
  
            //
            // Summary:
            //     Allows an object to try to free resources and perform other cleanup operations
            //     before it is reclaimed by garbage collection.
            ~GraphicsWindow();
  
            //
            // Summary:
            //     Gets or sets a Boolean which determines whether this instance is running.
            public bool IsRunning { get; set; }
            //
            // Summary:
            //     Gets or sets a Boolean which determines whether this instance is paused.
            public bool IsPaused { get; set; }
            //
            // Summary:
            //     Gets or sets the used Graphics surface.
            public Graphics Graphics { get; }
            //
            // Summary:
            //     Gets or sets the frames per second (frame rate) at which this instance invokes
            //     its DrawGraphics event.
            public int FPS { get; set; }
  
            //
            // Summary:
            //     Fires when you should free any resources used for drawing with this instance.
            public event EventHandler<DestroyGraphicsEventArgs> DestroyGraphics;
            //
            // Summary:
            //     Fires when a new Scene / frame needs to be rendered.
            public event EventHandler<DrawGraphicsEventArgs> DrawGraphics;
            //
            // Summary:
            //     Fires when you should allocate any resources you use to draw using this instance.
            public event EventHandler<SetupGraphicsEventArgs> SetupGraphics;
  
            //
            public override void Create();
            //
            public override void Join();
            //
            // Summary:
            //     Pauses the graphics thread.
            public void Pause();
            //
            // Summary:
            //     Resumes the graphics thread.
            public void Unpause();
            //
            // Summary:
            //     Releases all resources used by this GraphicsWindow.
            //
            // Parameters:
            //   disposing:
            //     A Boolean value indicating whether this is called from the destructor.
            protected override void Dispose(bool disposing);
            //
            // Summary:
            //     Gets called when the graphics thread destorys the Graphics surface.
            //
            // Parameters:
            //   graphics:
            //     A Graphics surface.
            protected virtual void OnDestroyGraphics(Graphics graphics);
            //
            // Summary:
            //     Gets called when the graphics thread needs to render a new Scene / frame.
            //
            // Parameters:
            //   frameCount:
            //     The number of the currently rendered frame. Starting at 1.
            //
            //   frameTime:
            //     The current time in milliseconds.
            //
            //   deltaTime:
            //     The elapsed time in milliseconds since the last frame.
            protected virtual void OnDrawGraphics(int frameCount, long frameTime, long deltaTime);
            //
            // Summary:
            //     Gets called when the graphics thread setups the Graphics surface.
            //
            // Parameters:
            //   graphics:
            //     A Graphics surface.
            protected virtual void OnSetupGraphics(Graphics graphics);
            //
            protected override void OnSizeChanged(int width, int height);
            //
            protected override void OnVisibilityChanged(bool isVisible);
        }
    }


    using System;
    using System.Collections.Generic;
    using System.Text;
  
    using GameOverlay.Drawing;
    using GameOverlay.Windows;
  
     namespace StudyCSharp
    {
        public class OverlayQuestion : IDisposable
        {
            private readonly GraphicsWindow _window;
  
  
     public OverlayQuestion()
            {
                StudyX.Module1.initializeModule1();
  
                _brushes = new Dictionary<string, SolidBrush>();
                _fonts = new Dictionary<string, Font>();
                _images = new Dictionary<string, Image>();
  
                generateStudyQuestion();
              
  
  
  
  
                var gfx = new Graphics()
                {
                    MeasureFPS = true,
                    PerPrimitiveAntiAliasing = true,
                    TextAntiAliasing = true
                };
  
                int _ScreenWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
                int _ScreenHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
  
                _window = new GraphicsWindow(0, 0, _ScreenWidth, _ScreenHeight, gfx)
                {
                    FPS = 60,
                    IsTopmost = true,
                    IsVisible = true
                };
  
                _window.DestroyGraphics += _window_DestroyGraphics;
                _window.DrawGraphics += _window_DrawGraphics;
                _window.SetupGraphics += _window_SetupGraphics;
            }
    }
 

rex64

Member
Joined
Jul 31, 2020
Messages
14
Programming Experience
10+
but I do appreciate the help even if it is critical. Anyways, we are not using this for cheating. We are using the overlay for educational purposes. I like the idea of submitting this to some of the anti cheat systems. Send me a list. Most of the anti-cheat systems will take a screenshot and a human will analyze the result when they see a new application that changes the GUI. In our case we will be the opposite of an anti cheat. Players will have reduced performance in game but better performance in education.

List of Anti Cheat:
Valve VAC
Punkbuster
FairFight (EA?)
EAC Easy Anti-Cheat

Proof of our project:
 
Last edited by a moderator:

rex64

Member
Joined
Jul 31, 2020
Messages
14
Programming Experience
10+
For the record, when you use someone else's library. You are not using your own code, you are in fact using someone else's code which you clearly copied from Github. That doesn't make you the author of the code.
By your definition Michel Pi would not be the author of his code either because he used SlimDX. And SlimDX would not be author of their code because they used DirectX. Even Bill Gates is probably not the author of his code because he bought QDOS July 27 is a momentous day in Microsoft history — here's why
 

Sheepings

Retired Programmer
Staff member
Joined
Sep 5, 2018
Messages
1,877
Location
UK
Programming Experience
10+
Congratulations you found out how to post a steam page via the dev store on Steam. That doesn't prove anything. What type of keys are you trying to store? I assume you are tying to acquire users game key codes?
Steam don't allow that through their API. By you advertising a program which likely circumvents this protection of users game key codes. I am sure it is against Steams terms of service. If you are providing your own keys for games provided by your application, then that's Ok. Once again, I'm trying to guide you, so that you do what you're doing correctly.

By your definition Michel Pi would not be the author of his code either because he used SlimDX. And SlimDX would not be author of their code because they used DirectX. Even Bill Gates is probably not the author of his code because he bought QDOS July 27 is a momentous day in Microsoft history — here's why

First. Don't try to be funny by being a smart arse posting rhetorical statements. I've been nothing but helpful by providing you with additional answers about how you should go about your app creation, while I also questioned you about your product too. And you chose not to engage with me once on any of my suggestions.

Secondly. You know exactly what you were claiming. It's clearly written in earlier posts where you said you were the author of the code, which also means to assume that you wrote the documentation also. Michel didn't claim to be the author of the libraries he used, did he?

Thirdly. If you don't state clearly the intentions of your project, and its purpose of use, then you will be questioned so we ascertain what basis and purpose your application serves. You could have avoided such questions had you been more forthcoming with your answers to the questions I first asked on the first page, instead of responding with shady one liners which leave more questions...

Lastly, if you come back and accuse me of attacking you again, I will ban you from the forum. Please keep your assertions to yourself. (Now removed)

If you don't want your project/character ridiculed, or scrutinised, then don't post on a public forum claiming to be someone you are not. If any person on this board had concerns about your project, it is there right to question you about your project until they are satisfied your project is not going to cause other people loss or harm. If you can not respect that, then find another forum who support those types of activities without question.
 
Top Bottom