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. In MFC, how can I find the actual signature of a function which is combined with a specific notification [modified]

In MFC, how can I find the actual signature of a function which is combined with a specific notification [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++helptutorial
2 Posts 2 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.
  • D Offline
    D Offline
    David YueZuo
    wrote on last edited by
    #1

    Hey guys, Help! I have been using visual C++ for a while, but there is a issue always make me confused. The description of the issue: We use this Macro very often: ON_NOTIFY(wNotifyCode, id, memberFxn), but how do you know what is the actual signature of memberFxn. For instance, when we use ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText) At the same time, we will define a function called OnToolTipText, the signature of this function is: OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult) For the parameter pNMHDR, we know the actual data type maybe not NMHDR, sometime we convert it by using a specific data type rather than using it directly. The actual struct of NMHDR is: typedef struct tagNMHDR { HWND hwndFrom; UINT idFrom; UINT code; } NMHDR; For the notification TTN_NEEDTEXTW, we convert parameter pNMHDR by using TOOLTIPTEXTA, so my question is: how, when and where do you know you should use TOOLTIPTEXTA to convert it? why don't you use something else? is there any documents talk about what type we should use to convert a specific parameter? PS: If you don't mind, I have one more question, is there anyone knows how to use CListCtrl::SetInfoTip()? I want to set a tooltip for each cell of the table, I tired to use SetInfoTip(), but it doesn't work well. Can you teach me how to use it? Thank you so much!

    David Zuo

    M 1 Reply Last reply
    0
    • D David YueZuo

      Hey guys, Help! I have been using visual C++ for a while, but there is a issue always make me confused. The description of the issue: We use this Macro very often: ON_NOTIFY(wNotifyCode, id, memberFxn), but how do you know what is the actual signature of memberFxn. For instance, when we use ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText) At the same time, we will define a function called OnToolTipText, the signature of this function is: OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult) For the parameter pNMHDR, we know the actual data type maybe not NMHDR, sometime we convert it by using a specific data type rather than using it directly. The actual struct of NMHDR is: typedef struct tagNMHDR { HWND hwndFrom; UINT idFrom; UINT code; } NMHDR; For the notification TTN_NEEDTEXTW, we convert parameter pNMHDR by using TOOLTIPTEXTA, so my question is: how, when and where do you know you should use TOOLTIPTEXTA to convert it? why don't you use something else? is there any documents talk about what type we should use to convert a specific parameter? PS: If you don't mind, I have one more question, is there anyone knows how to use CListCtrl::SetInfoTip()? I want to set a tooltip for each cell of the table, I tired to use SetInfoTip(), but it doesn't work well. Can you teach me how to use it? Thank you so much!

      David Zuo

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      All ON_NOTIFY handlers have the same signature. For other macros, see the documentation for that macro. The convention for any message sent with WM_NOTIFY is for the lParam parameter of the window message to point to a structure that either is, or begins with, an NMHDR structure - the notification code is actually part of this structure. To find out if there's an extended structure sent with a given notification code, check the documentation for that code. In your specific situation you should be matching a TOOLTIPTEXT**W** structure with the TTN_NEEDTEXTW notification. In general you should consider using the versions with no character-encoding-width indicator, TTN_NEEDTEXT and, as documented in the latest MSDN Library, a NMTTDISPINFO structure.

      Stability. What an interesting concept. -- Chris Maunder

      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