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. PostMessage (hWnd = 0)

PostMessage (hWnd = 0)

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 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.
  • G Offline
    G Offline
    Goa
    wrote on last edited by
    #1

    i have a keyboard filter function: LRESULT CALLBACK KbHookProc(int, WPARAM, LPARAM); and a global variable: for example, HWND hWnd; then i set the value of the variable... but my function doesn't see this value and in this function hWnd is NULL why? :(

    A M L 3 Replies Last reply
    0
    • G Goa

      i have a keyboard filter function: LRESULT CALLBACK KbHookProc(int, WPARAM, LPARAM); and a global variable: for example, HWND hWnd; then i set the value of the variable... but my function doesn't see this value and in this function hWnd is NULL why? :(

      A Offline
      A Offline
      Alvaro Mendez
      wrote on last edited by
      #2

      It's difficult to understand your exact problem. It looks to me like you have a global variable named hWnd but then you also have a local one of the same name. Please post some code so we can help you better. Regards, Alvaro

      1 Reply Last reply
      0
      • G Goa

        i have a keyboard filter function: LRESULT CALLBACK KbHookProc(int, WPARAM, LPARAM); and a global variable: for example, HWND hWnd; then i set the value of the variable... but my function doesn't see this value and in this function hWnd is NULL why? :(

        M Offline
        M Offline
        Masaaki Onishi
        wrote on last edited by
        #3

        Hello, the codegurus around the world.;) If you use Window API's PostMessage, you have to pass the window handle called HWND. If this HWND is NULL (0), this Window isn't created yet. That is, PostMessage function will not post this message. So, maybe you had better use if (hWnd), and use PostMessage Windows API function inside callback function?:rolleyes: Have a nice day!

        -Masaaki Onishi-

        1 Reply Last reply
        0
        • G Goa

          i have a keyboard filter function: LRESULT CALLBACK KbHookProc(int, WPARAM, LPARAM); and a global variable: for example, HWND hWnd; then i set the value of the variable... but my function doesn't see this value and in this function hWnd is NULL why? :(

          L Offline
          L Offline
          luckylourson
          wrote on last edited by
          #4

          I think you should try a GetParent function wich is suppose to return the CWind* of the parent window. You can also have the hwind with (GetParent())->m_hWind

          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