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. Custom WM_NOTIFY NMHDR code

Custom WM_NOTIFY NMHDR code

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsontutorial
7 Posts 3 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
    ClickHeRe
    wrote on last edited by
    #1

    I'm currently building a custom control from scratch in Win32 API (no MFC). It's a divder control (something like the MFC splitter). I defined some notification events to be sent to the parent window like DVN_DELETEDPANE, but I don't know what number to give to the constant. It will be put in NMHDR.code to be sent with WM_NOTIFY to the parent control. I want to know how to define them so they don't conflict with existing values for other controls. Thank You David

    N F 2 Replies Last reply
    0
    • C ClickHeRe

      I'm currently building a custom control from scratch in Win32 API (no MFC). It's a divder control (something like the MFC splitter). I defined some notification events to be sent to the parent window like DVN_DELETEDPANE, but I don't know what number to give to the constant. It will be put in NMHDR.code to be sent with WM_NOTIFY to the parent control. I want to know how to define them so they don't conflict with existing values for other controls. Thank You David

      N Offline
      N Offline
      nm_114
      wrote on last edited by
      #2

      this probably won't help you much but you might want to just define your own message instead of using WM_NOTIFY. when MS updates the common controls new constants for NMHDR.code might be added so i don't think there is any way of knowing for sure there won't be any conflicts in the future...

      C 1 Reply Last reply
      0
      • N nm_114

        this probably won't help you much but you might want to just define your own message instead of using WM_NOTIFY. when MS updates the common controls new constants for NMHDR.code might be added so i don't think there is any way of knowing for sure there won't be any conflicts in the future...

        C Offline
        C Offline
        ClickHeRe
        wrote on last edited by
        #3

        I understand, but then how to define a custom WM_???? that doesn't conflict with other conrols using WM_USER or WM_APP as I see common controls also use WM_USER + N do define their custom messages.

        N 1 Reply Last reply
        0
        • C ClickHeRe

          I understand, but then how to define a custom WM_???? that doesn't conflict with other conrols using WM_USER or WM_APP as I see common controls also use WM_USER + N do define their custom messages.

          N Offline
          N Offline
          nm_114
          wrote on last edited by
          #4

          the only things i can think of are put

          #ifndef divctrl_notify
          #define divctrl_notify (wm_app+1)
          #endif
          

          in the divctrl header and if it conflicts with other msgs you've defined, define divctrl_notify as something else before you include the header. a better way might be to just use WM_COMMAND like other windows controls and let the notification codes be anything you want (the notification codes for the different win ctrls seem to all conflict anyway). just make sure you check the id of the ctrl (so you what type of ctrl it is) before parsing the notification codes and there shouldn't be a problem (i think??).

          C 1 Reply Last reply
          0
          • N nm_114

            the only things i can think of are put

            #ifndef divctrl_notify
            #define divctrl_notify (wm_app+1)
            #endif
            

            in the divctrl header and if it conflicts with other msgs you've defined, define divctrl_notify as something else before you include the header. a better way might be to just use WM_COMMAND like other windows controls and let the notification codes be anything you want (the notification codes for the different win ctrls seem to all conflict anyway). just make sure you check the id of the ctrl (so you what type of ctrl it is) before parsing the notification codes and there shouldn't be a problem (i think??).

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

            The problem is that this is a DLL to add support for UI making in another application. The ID of the control is not know to the DLL window procedures, it just parses the correct messages and sends the info back to the calling app through callback support. Anyways, thanks for the information, I'll see what I can do to get around the problem, I think I have a solution that will work even though there is a conflict.

            N 1 Reply Last reply
            0
            • C ClickHeRe

              The problem is that this is a DLL to add support for UI making in another application. The ID of the control is not know to the DLL window procedures, it just parses the correct messages and sends the info back to the calling app through callback support. Anyways, thanks for the information, I'll see what I can do to get around the problem, I think I have a solution that will work even though there is a conflict.

              N Offline
              N Offline
              nm_114
              wrote on last edited by
              #6

              ClickHeRe wrote: The problem is that this is a DLL to add support for UI making in another application i see. RegisterWindowMessage() might help.

              1 Reply Last reply
              0
              • C ClickHeRe

                I'm currently building a custom control from scratch in Win32 API (no MFC). It's a divder control (something like the MFC splitter). I defined some notification events to be sent to the parent window like DVN_DELETEDPANE, but I don't know what number to give to the constant. It will be put in NMHDR.code to be sent with WM_NOTIFY to the parent control. I want to know how to define them so they don't conflict with existing values for other controls. Thank You David

                F Offline
                F Offline
                FearTheDoubleShift
                wrote on last edited by
                #7

                Read this: http://blogs.msdn.com/oldnewthing/archive/2009/08/21/9877791.aspx[^] The two key portions are: "WM_NOTIFY is basically a sender-defined version of WM_USER" "It is an unwritten convention that the notification codes for the common controls are all negative numbers. This leaves positive numbers for applications to use for their own purposes."

                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