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. How to detect which object called the message

How to detect which object called the message

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

    Hi everyone, I am using VC++ 6. I have a 3 listcontrols which display different data. I have customized the list control for the look and feel by creating a class "CCustomListCtrl" .I have created 3 instances of "CCustomListCtrl" in CMainFrame. class which I am using notification message "NM_CLICK" to detect the click on the list. Now i want to identify which of the user has clicked.

    N N R 3 Replies Last reply
    0
    • C chaitannya_m

      Hi everyone, I am using VC++ 6. I have a 3 listcontrols which display different data. I have customized the list control for the look and feel by creating a class "CCustomListCtrl" .I have created 3 instances of "CCustomListCtrl" in CMainFrame. class which I am using notification message "NM_CLICK" to detect the click on the list. Now i want to identify which of the user has clicked.

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      chaitannya_m wrote:

      Now i want to identify which of the user has clicked.

      There is an NMHDR structure that's given as parameter to the function. It contains a variable called hwndFrom which denotes the control from which the notification came. You can use this handle.


      Nibu thomas A Developer Code must be written to be read, not by the compiler, but by another human being. http:\\nibuthomas.wordpress.com

      1 Reply Last reply
      0
      • C chaitannya_m

        Hi everyone, I am using VC++ 6. I have a 3 listcontrols which display different data. I have customized the list control for the look and feel by creating a class "CCustomListCtrl" .I have created 3 instances of "CCustomListCtrl" in CMainFrame. class which I am using notification message "NM_CLICK" to detect the click on the list. Now i want to identify which of the user has clicked.

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #3

        chaitannya_m wrote:

        class which I am using notification message "NM_CLICK"

        Instead of handling the message in the CCustomListCtrl, handle that message in the CMainFrame itself. NM_CLICK is actually a notification. So handle the WM_NOTIFY message in the CMainFrame and check whether the code is NM_CLICK.

        nave [OpenedFileFinder]

        1 Reply Last reply
        0
        • C chaitannya_m

          Hi everyone, I am using VC++ 6. I have a 3 listcontrols which display different data. I have customized the list control for the look and feel by creating a class "CCustomListCtrl" .I have created 3 instances of "CCustomListCtrl" in CMainFrame. class which I am using notification message "NM_CLICK" to detect the click on the list. Now i want to identify which of the user has clicked.

          R Offline
          R Offline
          Rajkumar R
          wrote on last edited by
          #4

          I guess you need to identify the list control which send the NM_CLICK notification message. NM_CLICK notification returns the id and handle to window of list control, this can be used to identify the control. Best Regards Raj

          C 1 Reply Last reply
          0
          • R Rajkumar R

            I guess you need to identify the list control which send the NM_CLICK notification message. NM_CLICK notification returns the id and handle to window of list control, this can be used to identify the control. Best Regards Raj

            C Offline
            C Offline
            chaitannya_m
            wrote on last edited by
            #5

            how to use the handle dude...i tried NMHDR ..it does give different values for the list, but how to identify which value is for what. Well i have to use the custom control for sure, its for different purpose. Also i can't use the click notification in the mainframe since i have listcontrols in different windows

            R 1 Reply Last reply
            0
            • C chaitannya_m

              how to use the handle dude...i tried NMHDR ..it does give different values for the list, but how to identify which value is for what. Well i have to use the custom control for sure, its for different purpose. Also i can't use the click notification in the mainframe since i have listcontrols in different windows

              R Offline
              R Offline
              Rajkumar R
              wrote on last edited by
              #6

              chaitannya_m wrote:

              how to use the handle dude

              I prefer to use ID than handle but no matters.

              chaitannya_m wrote:

              i tried NMHDR ..it does give different values for the list, but how to identify which value is for what.

              You need to store the values of ID when the list control is created and matching the value with which the NMHDR returns identifies the list control.

              chaitannya_m wrote:

              Also i can't use the click notification in the mainframe since i have listcontrols in different windows

              You can use message handlers in its parent window.

              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