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 Not Working With WH_GETMESSAGE-MFC

Postmessage Not Working With WH_GETMESSAGE-MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
5 Posts 3 Posters 2 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.
  • S Offline
    S Offline
    srinivasankrishnaa
    wrote on last edited by
    #1

    Hi, I Have Installed A Hook With WH_GETMESSAGE On A DLL Using MFC.But When I Send Postmessage To My Parent Window It Is Not Received...

    HWND hwndmain; //(Assigned The Value Of Main Window HWND)

    static UINT snd=::RegisterWindowMessage(L"mainwnd_msg");

    ::PostMessage(hwndmain,snd,0,0);

    The Same Message Is Declared In The Main Window To Receive The Registered Window Message And Added On register message event also But It Is Not Working Kindly Help Me I'm Not Able To Find What Is Happenning...

    L 1 Reply Last reply
    0
    • S srinivasankrishnaa

      Hi, I Have Installed A Hook With WH_GETMESSAGE On A DLL Using MFC.But When I Send Postmessage To My Parent Window It Is Not Received...

      HWND hwndmain; //(Assigned The Value Of Main Window HWND)

      static UINT snd=::RegisterWindowMessage(L"mainwnd_msg");

      ::PostMessage(hwndmain,snd,0,0);

      The Same Message Is Declared In The Main Window To Receive The Registered Window Message And Added On register message event also But It Is Not Working Kindly Help Me I'm Not Able To Find What Is Happenning...

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

      The RegisterWindowMessage function is for sharing a message between different applications. For user messages in a single application see RegisterWindowMessageA function | Microsoft Docs[^].

      S 1 Reply Last reply
      0
      • L Lost User

        The RegisterWindowMessage function is for sharing a message between different applications. For user messages in a single application see RegisterWindowMessageA function | Microsoft Docs[^].

        S Offline
        S Offline
        srinivasankrishnaa
        wrote on last edited by
        #3

        Thank you For Your Reply,But My Problem Is I Have Installed A WH_GETMESSAGE Hook In a DLL.The DLL Is Loaded On To Notepad Process.The DLL Will Post The Message To Mainwindow When Key 'A' Is Pressed.The Main Window(HWND) Which Has Triggered The Hook Is Unable To Receive The "Postmessage" Posted To It.But Notepad(HWND) Is Able To receive The Postmessage Posted To It...

        L L 2 Replies Last reply
        0
        • S srinivasankrishnaa

          Thank you For Your Reply,But My Problem Is I Have Installed A WH_GETMESSAGE Hook In a DLL.The DLL Is Loaded On To Notepad Process.The DLL Will Post The Message To Mainwindow When Key 'A' Is Pressed.The Main Window(HWND) Which Has Triggered The Hook Is Unable To Receive The "Postmessage" Posted To It.But Notepad(HWND) Is Able To receive The Postmessage Posted To It...

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

          I am afraid it is impossible to guess what may be happening. You will need to use your debugger to gather more information.

          1 Reply Last reply
          0
          • S srinivasankrishnaa

            Thank you For Your Reply,But My Problem Is I Have Installed A WH_GETMESSAGE Hook In a DLL.The DLL Is Loaded On To Notepad Process.The DLL Will Post The Message To Mainwindow When Key 'A' Is Pressed.The Main Window(HWND) Which Has Triggered The Hook Is Unable To Receive The "Postmessage" Posted To It.But Notepad(HWND) Is Able To receive The Postmessage Posted To It...

            L Offline
            L Offline
            leon de boer
            wrote on last edited by
            #5

            First PostMessage returns a result and check the value of the message handle before the dispatch ... act like a programmer, you can easily give us a hell of a lot more information than you have. At a guess the window you are sending it to is not active or the window you are trying to post from is a dialog in the modal state. Can't tell much beyond that you haven't explained or given us enough detail.

            In vino veritas

            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