Announcement

Collapse
No announcement yet.

How to get message description

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get message description

    If I have a message such as WM_PAINT, is there an API/function that will return the string description of that message? I want to do it in a program, not just go look it up in MSDN.

    I've looked up a dozen search terms and can't seem to find anything that does it - in the PB forums and on the web. Surely there is such a thing and I'm just a bad searcher!

    I'm wanting to do it outside of a callback function, if it's possible.

    Maybe I'm just not using the right search terms.

  • #2
    What do you mean by "description? " Do you mean the text as you would find on MSDN, e.g., for WM_COMMAND you would get ..
    The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.
    I've never seen anything like that from any source. Then again, I've never really looked.

    If you had the url at MSDN for each message of interest, you could get the text of the page and display that in your program, that's not hard at all.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      If I have a message such as WM_PAINT, is there an API/function that will return the string description of that message?
      If you find it (or create one yourself), I'd recommend not poping up a message box during a WM_PAINT!
      Fred
      "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

      Comment


      • #4
        If you have the SDK installed on your machine, using the INDEX tab / window / whatever, you start entering WM_ and it will scroll you to all the WM_ messages which have been indexed into the system.

        CTRL+ALT+F2 or View -> Navigation -> Index

        Oh wait, you want the program which gets the message to return a string description of the message?
        Last edited by colin glenn; 28 Feb 2009, 03:16 PM. Reason: re-read the original post
        Furcadia, an interesting online MMORPG in which you can create and program your own content.

        Comment


        • #5
          Thanks for the response guys.

          Yep, I want to get a text string, such as "WM_PAINT", that corresponds to a numerical message value I pass.

          I suppose I could make one easy enough. I just figured that Windows had one I could already use.

          Based on the sample response of 3, and my failed web search, I guess there's not a Windows function that does it. I'm very surprised!

          Here are two sites that have lengthy lists.

          http://wiki.winehq.org/List_Of_Windows_Messages
          http://www.autohotkey.com/docs/misc/SendMessageList.htm

          I guess I'll just put the values in a file and write up my own search function. Won't be more than a dozen lines of code.
          Last edited by Gary Beene; 28 Feb 2009, 03:57 PM.

          Comment


          • #6
            There's also a very interesting list here.

            In addition to messages, it also give the wParam/lParam content for each message. That would be way cool to have at my fingertips - in an app, but also as a stand alone search tool as well.

            http://dzonny.cz/Software/Blog/tabid...S/Default.aspx

            But it's formatted for some kind of XML/.NET-ish? reader that I'm not familiar with.

            Does anyone recognize the format, and have a suggestion on how to use it in PB.

            Comment


            • #7
              Yep, I want to get a text string, such as "WM_PAINT", that corresponds to a numerical message value I pass.
              Well, if that's what you want, there is no API function.

              What there IS is, the WinMsg code in the samples directory installed with the compiler.
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Michael,

                Thanks for the point to the Sample.

                The problem with going through the samples as I did - early on when I first started with PB - is that you don't know what's of interest/value to you or not.

                Now, I'll have to go through them again to see what other gems I might have missed!

                Comment


                • #9
                  I think someone also recently posted a function to same thing, with the literals coded inline rather than using a STRINGTABLE resource with a function in a DLL.

                  As far as what is or is not of interest....didn't I address this in an earlier thead? Sometimes a particular notification IS of interest... and sometimes it isn't.

                  But let's say you want to see a group of messages.....

                  For example, I'll sometimes test what messages are generated in what order when some event occurs just to see which comes first... eg, when the user hits the tab key, in what order do we get the Keydown, Keyup, WM_CHAR, KILLFOCUS (where we were) and SETFOCUS (where we are going) notifications?

                  That can tell me in what order I have to do things to avoid stepping on myself.
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment


                  • #10
                    Not sure I understand what you need...

                    I often search through win32api.inc to study groups of messages, then I go to the SDK dox for descriptions and details.

                    Have you examined win32api.inc?

                    Comment


                    • #11
                      Hi John,

                      I was wanting programmatic access to text descriptions of messages. I was wanting to look at and/or list the messages that rolled through my callback functions.

                      The sample app, WinMsg pretty much does what I wanted. I've been using it for the last few days. When I first got PB I went through the samples but WinMsg didn't stick in my brain.

                      WinMsg's message list seems pretty complete, but I must admit I've not done any kind of comparison between it's rc file content and the list of messages I've found on other sites (or the one I generated myself).

                      MSDN or the SDk has all the info I need, and I am constantly reading MSDN these days. But I needed something I could use in one of my apps.

                      What I still want, and WinMsg doesn't do, is provide a lookup on common control notifications that come in with the messages WM_COMMAND and WM_NOTIFY.

                      I have a list of all the MSDN notifications for common controls, so I could create a replicate of WinMsg, call it WinNotify. It would require a little different interface - sending both the control class as the control message number.

                      It's on my list to do.

                      Comment


                      • #12
                        have a list of all the MSDN notifications for common controls, so I could create a replicate of WinMsg, call it WinNotify. It would require a little different interface - sending both the control class as the control message number
                        The notification codes (NM.CODE) (nmhdr.code) from the Microsoft common controls do not share any values with regular WM_xxxx messages (they are all less than zero when cast as LONG) (bit 31 is set), so you "could" just extend the STRINGTABLE resource if you wanted...

                        I have not checked ALL the common code notifications, but I know that's true for at least listiew, treeview, trackbar, statusbar.

                        However, I'm not sure how that might work out for long-term maintenance... and I'm also not sure that some of the controls might not share notification code VALUES with different code names. (Check all the xxx_FIRST in CommCtrl.INC.)

                        It's just something to think about.....

                        Of course, you could always write your own little two-column resource...
                        Code:
                        #include "resource.h"
                        CODES       RT_RCDATA
                        BEGIN 
                            -100L, "LVN_ITEMCHANGING\0",
                            -101L, "LVN_ITEMCHANGED\0", 
                            -102L ,"LVN_INSERTITEM\0", 
                            {value}, {name}, ...
                        ...
                        END
                        .. and write a function to load 'em up and search 'em as required.

                        MCM
                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment

                        Working...
                        X