Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8200783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:34:11+00:00 2026-06-07T06:34:11+00:00

I made a very simple program, but when I close it using the red

  • 0

I made a very simple program, but when I close it using the red X at the top right, I can still see it in the Windows Task Manager listed under processes. The program is still running and consuming memory. How can I avoid this?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;

namespace PS3Controller
{
public partial class Form1 : Form
{
    GamePadState pad;

    Vector2 centroIzq = new Vector2(138, 132);
    Vector2 centroDer = new Vector2(139, 252);

    float distancia = 20f;

    float ledIzqAngulo = 0;
    float ledDerAngulo = 0;

    float ledIzqVelocidad = 0.0022f;
    float ledDerVelocidad = 0.0022f;


    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        pad = GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One);

        if (pad.Buttons.Y == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledTtriangulo.Visible = true;
        else
            ledTtriangulo.Visible = false;

        if (pad.Buttons.X == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledCuadrado.Visible = true;
        else
            ledCuadrado.Visible = false;

        if (pad.Buttons.A == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledX.Visible = true;
        else
            ledX.Visible = false;

        if (pad.Buttons.B == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledCirculo.Visible = true;
        else
            ledCirculo.Visible = false;

        if (pad.DPad.Left == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledIzq.Visible = true;
        else
            ledIzq.Visible = false;

        if (pad.DPad.Right == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledDer.Visible = true;
        else
            ledDer.Visible = false;

        if (pad.DPad.Up == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledArriba.Visible = true;
        else
            ledArriba.Visible = false;

        if (pad.DPad.Down == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledAbajo.Visible = true;
        else
            ledAbajo.Visible = false;

        if (pad.Buttons.Start == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledStart.Visible = true;
        else
            ledStart.Visible = false;

        if (pad.Buttons.Back == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledSelect.Visible = true;
        else
            ledSelect.Visible = false;

        if (pad.Buttons.LeftShoulder == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledL1.Visible = true;
        else
            ledL1.Visible = false;

        if (pad.Buttons.RightShoulder == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledR1.Visible = true;
        else
            ledR1.Visible = false;

        if (pad.Buttons.BigButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            ledHome.Visible = true;
        else
            ledHome.Visible = false;

        if (pad.Triggers.Left > 0)
            ledL2.Visible = true;
        else
            ledL2.Visible = false;

        if (pad.Triggers.Right > 0)
            ledR2.Visible = true;
        else
            ledR2.Visible = false;

        lblIzqX.Text = pad.ThumbSticks.Left.X.ToString();
        lblIzqY.Text = pad.ThumbSticks.Left.Y.ToString();
        lblDerX.Text = pad.ThumbSticks.Right.X.ToString();
        lblDerY.Text = pad.ThumbSticks.Right.Y.ToString();


        Vector2 ledIzqPos = new Vector2(
            (float)Math.Cos(ledIzqAngulo) * distancia,
            (float)Math.Sin(ledIzqAngulo) * distancia);

        Vector2 ledDerPos = new Vector2(
            (float)Math.Cos(ledDerAngulo) * distancia,
            (float)Math.Sin(ledDerAngulo) * distancia);

        if (pad.ThumbSticks.Right.X == 0 &&
            pad.ThumbSticks.Right.Y == 0)
        {
            ledPadDer.Top = 139;
            ledPadDer.Left = 252;
        }

        if (pad.ThumbSticks.Left.X == 0 &&
            pad.ThumbSticks.Left.Y == 0)
        {
            ledPadIzq.Top = 138;
            ledPadIzq.Left = 132;
        }


    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:34:12+00:00Added an answer on June 7, 2026 at 6:34 am

    Be sure to close all the thread of that process…Sometime, the thread keep process to keep executing though the form is closed…You can do this in OnClosing method of windows form……

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a very simple spinlock using the Interlocked functions in Windows and tested
So I made this (very simple) program with a swing GUI with NetBeans, and
I recently made a very simple practice program in Python, that takes user input
Very simple question, I made the following program : #include <stdlib.h> int main(int argc,
I made a very simple application to store variables that can be edited onto
I've made a very simple aspect, and found a problem when debugging it (see
I have made a very simple AppleScript to close tabs in Safari. The problem
I decided to implement a very simple program recursively, to see how well Java
So I made a very simple program that counts down from 99 (sings 99
I'm trying to write a simple program using WinSnmp in C++. There is very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.