whoelse99

I am trying to make an application the locks the screen, then on my button psuh, it closes. I have the press part and the close part but now I am trying to make sure it stays open if somone Alt+f4 or Control+Alt+Delete. Here is my code so far:

protected override void Update(GameTime gameTime)

{

keyboardState = Keyboard.GetState();

// If the ESC key is pressed, skip the rest of the update.

if (exitKeyPressed() == false)

{

base.Update(gameTime);

Simulate();

}

}

void Simulate()

{

// Add game-specific logic.

}

bool exitKeyPressed()

{

// Check to see if ESC was pressed on the keyboard or Back was pressed on the controller.

if (keyboardState.IsKeyDown(Keys.Q))

{

if (keyboardState.IsKeyDown(Keys.W))

{

if (keyboardState.IsKeyDown(Keys.E))

{

if (keyboardState.IsKeyDown(Keys.R))

{

if (keyboardState.IsKeyDown(Keys.M))

{

Exit();

return true;

}

}

}

}

}

return false;

if (keyboardState.IsKeyDown(Keys.F4))

{

using (Game1 game = new Game1())

{

game.Run();

}

}

}

Moderators: I know this is longer than 10 lines but this is the part of the program that I need help with, it can't be shortened. (Im pretty sure)

____________________________________

How do I keep it open for Alt+f4 or Control+Alt+Delete and any other tricky ways




Re: XNA Game Studio Express App

Kyle_W

You cannot prevent the Windows Task Manager from terminating your application. Virus writers and hackers would love to have such a feature.



Re: XNA Game Studio Express App

pspballer07

The most they can do is prevent the task manager from opening. But then the user could download a homemade process viewer and terminate it with that.