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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. SetWindowsHookEx

SetWindowsHookEx

Scheduled Pinned Locked Moved C / C++ / MFC
c++
6 Posts 5 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.
  • M Offline
    M Offline
    Mohsin Munawar
    wrote on last edited by
    #1

    Does it have any constraint in MFC, because the same code works fine when I run on win32 console. Will be grateful.

    C M L 3 Replies Last reply
    0
    • M Mohsin Munawar

      Does it have any constraint in MFC, because the same code works fine when I run on win32 console. Will be grateful.

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      SetWindowsHookEx [^] is a Windows API. Calling it (correctly) in a MFC application or in a Win32 console application is the same.

      Veni, vidi, vici.

      1 Reply Last reply
      0
      • M Mohsin Munawar

        Does it have any constraint in MFC, because the same code works fine when I run on win32 console. Will be grateful.

        M Offline
        M Offline
        Malli_S
        wrote on last edited by
        #3

        What error code do you get?

        [Delegates]      [Virtual Desktop]      [Tray Me !]
        -Malli...! :rose:****

        1 Reply Last reply
        0
        • M Mohsin Munawar

          Does it have any constraint in MFC, because the same code works fine when I run on win32 console. Will be grateful.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Mohsin Munawar wrote:

          Does it have any constraint in MFC

          Yes. The documentation for the SetWindowsHookEx function[^] states that calling the CallNextHookEx function[^] is optional. This is not always the case for MFC windows. You need to always call the CallNextHookEx function[^] because the MFC classes may have hooks such as WH_CBT hook. Best Wishes, -David Delaune

          M 1 Reply Last reply
          0
          • L Lost User

            Mohsin Munawar wrote:

            Does it have any constraint in MFC

            Yes. The documentation for the SetWindowsHookEx function[^] states that calling the CallNextHookEx function[^] is optional. This is not always the case for MFC windows. You need to always call the CallNextHookEx function[^] because the MFC classes may have hooks such as WH_CBT hook. Best Wishes, -David Delaune

            M Offline
            M Offline
            Mohsin Munawar
            wrote on last edited by
            #5

            it works fine for some time on MFC. I get a feeling that it gets unhooked from the OS for some reason after approx 10 notifications

            S 1 Reply Last reply
            0
            • M Mohsin Munawar

              it works fine for some time on MFC. I get a feeling that it gets unhooked from the OS for some reason after approx 10 notifications

              S Offline
              S Offline
              Stephen Hewitt
              wrote on last edited by
              #6

              Post some code. Not reams of code if you expect an answer, a minimal program that shows your problem. I concede that at times this is easier said than done.

              Steve

              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