Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Windows Hook

Windows Hook

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RedDragon2k
    wrote on last edited by
    #1

    Hi Guys I want to prevent my app getting terminated by the taskmanager. I saw some examples but they are using dlls that you have to pay for. So I informed myself a bit about that. I figured out that i've to use SetWindowHookEx. And there we are at my first problem: What type of Hook should i use ? i prefered WH_CALLWNDPROC. And how do i have to realize the main loop ? Is it a function that i get with the hook ? I'm never used hooks before, but i'm sure with some help i could do it. MFG RedDragon P.S.: The code will never be used to cause any damage to hard- or software. I'm working on a program which controls pupil pc's. Unix and C are the ultimate computer viruses.

    M S 2 Replies Last reply
    0
    • R RedDragon2k

      Hi Guys I want to prevent my app getting terminated by the taskmanager. I saw some examples but they are using dlls that you have to pay for. So I informed myself a bit about that. I figured out that i've to use SetWindowHookEx. And there we are at my first problem: What type of Hook should i use ? i prefered WH_CALLWNDPROC. And how do i have to realize the main loop ? Is it a function that i get with the hook ? I'm never used hooks before, but i'm sure with some help i could do it. MFG RedDragon P.S.: The code will never be used to cause any damage to hard- or software. I'm working on a program which controls pupil pc's. Unix and C are the ultimate computer viruses.

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      You can't, the user is ultimately in control of the computer. If what you want were possible, viruses could do the same thing. See The arms race between programs and users[^] and Why can't you trap TerminateProcess?[^] --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb

      R 1 Reply Last reply
      0
      • M Michael Dunn

        You can't, the user is ultimately in control of the computer. If what you want were possible, viruses could do the same thing. See The arms race between programs and users[^] and Why can't you trap TerminateProcess?[^] --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb

        R Offline
        R Offline
        RedDragon2k
        wrote on last edited by
        #3

        Yeah i see. I read this articles, too. But it is POSSIBLE. A programmer already done so. You can find the demo app on: http://www.madexcept.com/ under c++ and then go to MadCodeHook. Yeah you can come with this argument: Why don't you even this code ? Well, how could i get better when i just copy or use dlls from others ? MFG RedDragon P.S: Excuse my bad english Unix and C are the ultimate computer viruses.
        Visit me: www.programming.info.ms

        H 1 Reply Last reply
        0
        • R RedDragon2k

          Yeah i see. I read this articles, too. But it is POSSIBLE. A programmer already done so. You can find the demo app on: http://www.madexcept.com/ under c++ and then go to MadCodeHook. Yeah you can come with this argument: Why don't you even this code ? Well, how could i get better when i just copy or use dlls from others ? MFG RedDragon P.S: Excuse my bad english Unix and C are the ultimate computer viruses.
          Visit me: www.programming.info.ms

          H Offline
          H Offline
          heman154
          wrote on last edited by
          #4

          If your application is has a window, use classview and add the windows message handler: OnQueryEndSession. In the body, return false, and your application will prevent any shutdown that does not use the EWX_FORCE switch. Himanshu

          1 Reply Last reply
          0
          • R RedDragon2k

            Hi Guys I want to prevent my app getting terminated by the taskmanager. I saw some examples but they are using dlls that you have to pay for. So I informed myself a bit about that. I figured out that i've to use SetWindowHookEx. And there we are at my first problem: What type of Hook should i use ? i prefered WH_CALLWNDPROC. And how do i have to realize the main loop ? Is it a function that i get with the hook ? I'm never used hooks before, but i'm sure with some help i could do it. MFG RedDragon P.S.: The code will never be used to cause any damage to hard- or software. I'm working on a program which controls pupil pc's. Unix and C are the ultimate computer viruses.

            S Offline
            S Offline
            Shog9 0
            wrote on last edited by
            #5

            RedDragon2k wrote: I'm working on a program which controls pupil pc's. Have the students using accounts that do not have permission to terminate your process (which can be run under a different account). Just about anything else is dodgy as hell, and will eventually be broken by any student worth his salt.
            "The time has come," the Walrus said, "To talk of many things..."

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups