Jump to content


Photo

Event Responding to CTRL-ALT-DEL?


  • Please log in to reply
4 replies to this topic

#1 Harmonex

Harmonex

    GMC Member

  • GMC Member
  • 56 posts
  • Version:GM:HTML5

Posted 06 February 2012 - 10:43 PM

I'm wondering if it is possible to make an event respond to the input "CTRL-ALT-DEL" even though the Task Manager comes up. I'm new to Game Maker, so I'm not yet sure what is and isn't possible. I started with a code

if keyboard_check(vk_control) && keyboard_check(vk_alt) && keyboard_check(vk_left)
{sound_play(test)}

which worked fine each time I pressed the correct combination. I later changed it to

if keyboard_check(vk_control) && keyboard_check(vk_alt) && keyboard_check(vk_delete)
{sound_play(test)}

to see if it would work the same, but I heard no sound before or after the Task Manager popped up. Just to be completely sure, I modified it once more to

if keyboard_check(vk_control) && keyboard_check(vk_alt) && keyboard_check(vk_delete)
{game_end()}

and found that the game would stay each time, meaning that the code wasn't completing. If the OS interrupts (for safety reasons, I'm assuming), then there's nothing I can do from here, but I wanted to double check just in case.

Thanks in advance.
  • 0

#2 Troy Martin

Troy Martin

    Surreal Earth Studios

  • New Member
  • 91 posts
  • Version:Unknown

Posted 09 February 2012 - 12:28 AM

I'm fairly certain that the OS' keyboard handler itself hooks the mighty three-finger salute. Programs that get around that are generally regarded as potential malware, so it's best to just assume you can't do it.
  • 0

#3 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 10160 posts
  • Version:GM8

Posted 10 February 2012 - 12:39 AM

You will need to use keyboard_check_direct(key), not a normal keyboard_check. As soon as you press CTRL+ALT+DEL, the program should lose focus, so using keyboard_check_direct() should help there. And you will also need to tell GM to NOT pause when the program loses focus.
  • 0

#4 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 22051 posts
  • Version:GM:Studio

Posted 10 February 2012 - 07:13 AM

Care to tell us why you need this? I'm curious, especially as I can think of absolutely no legitemate reason...Posted Image
  • 0

#5 Harmonex

Harmonex

    GMC Member

  • GMC Member
  • 56 posts
  • Version:GM:HTML5

Posted 10 February 2012 - 07:42 AM

I was reading through functions when I came across the "keyboard_check_direct" one in regards to bringing back an out of focus window and I thought "Hey, that sounds like I could use it to...oh yeah, I posted that. Let's check." And sure enough there were several responses.

The reasons are semi-legitimate, as I'm creating an "unofficial sequel" to a creepypasta platform game (whose anonymous creator seems to have dropped off the planet) that used a lot of "fourth wall" breaking effects (including hiding the game as a process while faking a game over, then coming back and dragging the player to Hell). If you're worried that you're helping me create some form of malware, I could just kill taskmgr.exe in a step command without waiting for them to hit the relevant keys...much easier than disabling the keys. However, that would be counter-productive.

I actually don't know what I'm going to have connected to this event, but I'm imagining that the player would want to ctrl-alt-del out of either a scary part, or a blank part thinking the game froze. I want to have "something" happen when the command is pressed to encourage them to not close it down, so it'll probably just be a sound file (I'm sensing "laughter").

I considered a screamer, but that's the cheapest form of horror.

[EDIT]: On an unrelated note, I think I put this in the wrong board. I assumed just because I was using GM8, but really the questions probably apply to all versions. I'll put my next question in a different board (which will hopefully be the right one).

Edited by Harmonex, 12 February 2012 - 02:13 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users