Ok Keydown

This is a discussion on Ok Keydown within the Windows Programming forums, part of the Platform Specific Boards category; Hey, I want to build a Windows Service in VC++ 2010 that calls a function on keydown(Ctrl+Alt+F4), the only thing ...

  1. #1
    Registered User doctorzeus's Avatar
    Join Date
    Jan 2011
    Location
    UK
    Posts
    13

    Unhappy Ok Keydown

    Hey,

    I want to build a Windows Service in VC++ 2010 that calls a function on keydown(Ctrl+Alt+F4),

    the only thing is I'm pretty unfamiliar with the whole "calling functions with System Objects" thing and don't know How to make one that allows you to press these keys with the program running in the background...does anyone know the best way of doing this?

    In short I want a function that is called when Ctrl+Alt+F4 is pressed on the keyboard with the application running in the background.

    Any Help Would be Great!

    Oh yeah I can't for the life of me find a tutorial on calling functions with System Objects either so if anyone knows any good ones they would be willing to tell me about I'd apreciate it.

    Thanks

    Doctorzeus

  2. #2
    Registered User doctorzeus's Avatar
    Join Date
    Jan 2011
    Location
    UK
    Posts
    13
    Just FYI the threads meant to be named "On Keydown" not "Ok Keydown"

    LOL-typo

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Well, first of all, Windows keystrokes only go to foreground/focused windows... Background windows do not receive keyboard input.

    Non-ASCII input is generally handled as "Accelerators" that convert keystrokes into WM_COMMAND messages that are handled by your message dispatcher and loop.

    So, no, you're not likely to write a "service" to catch that without doing some serious system hooking and manipulation... pretty advanced stuff really.

    What exactly are you trying to accomplish?

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,584
    Given this:
    Dynamic Memory Address Handling

    I would say something along the lines of hack one of his games. Whether it is truly for single player or not is anyone's guess. Because we cannot verify the OPs intentions nor those of whom visit this thread we normally do not allow such discussions to occur.

  5. #5
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    RegisterHotKey Function (Windows)

    Not sure if it will work in windows services but I think it's the sort of thing you are looking for.

  6. #6
    Registered User doctorzeus's Avatar
    Join Date
    Jan 2011
    Location
    UK
    Posts
    13
    Quote Originally Posted by CommonTater View Post
    Well, first of all, Windows keystrokes only go to foreground/focused windows... Background windows do not receive keyboard input.

    Non-ASCII input is generally handled as "Accelerators" that convert keystrokes into WM_COMMAND messages that are handled by your message dispatcher and loop.

    So, no, you're not likely to write a "service" to catch that without doing some serious system hooking and manipulation... pretty advanced stuff really.

    What exactly are you trying to accomplish?
    Basically I want a program that terminates the current window process when those buttons are pressed, it would basically combat those annoying times when a program freezes so I don't have to terminate the process from the task manager...Kinda a "super" Alt+F4 is essentially what I am trying to make.

    Thanks

    Doctorzeus
    Last edited by doctorzeus; 01-08-2011 at 12:58 AM.

  7. #7
    Registered User doctorzeus's Avatar
    Join Date
    Jan 2011
    Location
    UK
    Posts
    13
    Quote Originally Posted by Bubba View Post
    Given this:
    Dynamic Memory Address Handling

    I would say something along the lines of hack one of his games. Whether it is truly for single player or not is anyone's guess. Because we cannot verify the OPs intentions nor those of whom visit this thread we normally do not allow such discussions to occur.
    Not true ,

    that was my other thread anyway, this one is a different program entirely..

    Doctorzeus

  8. #8
    Registered User doctorzeus's Avatar
    Join Date
    Jan 2011
    Location
    UK
    Posts
    13
    Quote Originally Posted by DeadPlanet View Post
    RegisterHotKey Function (Windows)

    Not sure if it will work in windows services but I think it's the sort of thing you are looking for.
    What would you go for?

    Doctorzeus

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by doctorzeus View Post
    Basically I want a program that terminates the current window process when those buttons are pressed, it would basically combat those annoying times when a program freezes so I don't have to terminate the process from the task manager...

    Thanks

    Doctorzeus
    Unfortunatly this can be used to close ANY window except a frozen one. Frozen Windows are those that do not respond to mouse or keyboard input... thus not closeable by that method.

    Frankly this is starting to sound like a Kick-off tool... perhaps one that lets you close the window of any player who's about to clobber you?

    Please do find a better way to use your programming skills.

  10. #10
    Registered User doctorzeus's Avatar
    Join Date
    Jan 2011
    Location
    UK
    Posts
    13
    Quote Originally Posted by CommonTater View Post
    Unfortunatly this can be used to close ANY window except a frozen one. Frozen Windows are those that do not respond to mouse or keyboard input... thus not closeable by that method.

    Frankly this is starting to sound like a Kick-off tool... perhaps one that lets you close the window of any player who's about to clobber you?

    Please do find a better way to use your programming skills.
    Ending the process from the process menu has always worked for me...

    Dunno why you are trying to back me into a corner and force me too admit that I have nefarious intentions when I don't..I honestly didn't see any realtion between this thread and my previous one when I first posted the two.

    My computing teacher said this would be a good thing to try when I suggested it

    Doctorzeus

  11. #11
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Oh gee, I dunno... maybe it's because you introduced yourself as wanting help with game cheats, then moved on to asking about code that has well known virus functionality.

    One of the oldest virus tricks is to track opening programs and immediately close them... It's often used to prevent people from getting into explorer or taskman and stopping the virus.

    Any teacher who would suggest this is a good thing to try probably shouldn't be teaching.

    Then, of course, there's the whole slippery slope thing... We help you, the word spreads, pretty soon this very helpful and friendly place is overrun by script kiddies and virus codes...

    Frankly, I think the Mods should close these two threads.

  12. #12
    Registered User doctorzeus's Avatar
    Join Date
    Jan 2011
    Location
    UK
    Posts
    13
    Quote Originally Posted by CommonTater View Post
    Oh gee, I dunno... maybe it's because you introduced yourself as wanting help with game cheats, then moved on to asking about code that has well known virus functionality.

    One of the oldest virus tricks is to track opening programs and immediately close them... It's often used to prevent people from getting into explorer or taskman and stopping the virus.

    Any teacher who would suggest this is a good thing to try probably shouldn't be teaching.

    Then, of course, there's the whole slippery slope thing... We help you, the word spreads, pretty soon this very helpful and friendly place is overrun by script kiddies and virus codes...

    Frankly, I think the Mods should close these two threads.
    Ok fine,

    If someone had told me that earlier I probubly wouldn't have posted either of them...

    You don't have to be a douche to me just because I didn't know as much as you do!

    Its clear that I'm not gonna be able to proove my good intentions, if I could withdraw this post I would.

    Doctorzeus
    Last edited by doctorzeus; 01-08-2011 at 02:44 AM.

  13. #13
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    611
    It's not a necessarily a bad task for the teacher to set, in theory. Beginners often have an over-inflated sense of their skills (not a slight against the OP, they just usually do), so I'd say setting them an impossible task, which this is without additionally installed components, is a good way to push them on. Or maybe I'm just overestimating that the teacher knew this was impossible and flippantly said "Sure kid, knock yourself out."
    Last edited by adeyblue; 01-08-2011 at 10:19 AM.

  14. #14
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,584
    Frankly, I think the Mods should close these two threads.
    Given we are walking the fine line between learning and hacking a game here and given the fact that the OP has resorted to name calling...I'm in complete agreement.

    Closed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Silverlight and KeyDown
    By xds4lx in forum C# Programming
    Replies: 3
    Last Post: 08-19-2010, 06:39 PM
  2. Keydown event in C ..
    By tariq7868 in forum C Programming
    Replies: 5
    Last Post: 06-18-2009, 01:46 PM
  3. LNK2001 ERROR!!! need help
    By lifeafterdeath in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2008, 05:05 PM
  4. keyboard event
    By SuperNewbie in forum Windows Programming
    Replies: 4
    Last Post: 06-10-2002, 06:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21