Announcement

Collapse
No announcement yet.

Why is %WM_USER used so much ?

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

  • Fred Buffington
    replied
    Thanks guys for the lesson. I figured it had to do with not messing with windows messages just wanted your expert knowledge.

    Leave a comment:


  • Gösta H. Lovgren-2
    replied
    For more on Wm_User go here: http://www.powerbasic.com/support/pb...ght=%25WM_USERSome old heavyweights weighed in (Borje, Lance, ...)

    ===========================================
    We must question the story logic
    of having an all-knowing all-powerful God,
    who creates faulty humans,
    and then blames them for his own mistakes.
    ~ Gene Roddenberry
    ===========================================

    Leave a comment:


  • Chris Boss
    replied
    Actually it goes a little further.

    The API docs indicate that Microsoft defined specific ranges for different types of messages.

    The system needs to have a range for messages common to all windows.

    This range is:

    0 to (WM_USER-1)

    Messages like WM_PAINT, WM_COMMAND, WM_NOTIFY, etc fall into this range.

    Next, there is a range of messages for user define messages for private window classes. It is important to note that you shouldn't use this range for user defined messages for an existing window class (ie. you subclass an edit control or a common control). The only acception is probably the Dialog class, since there does not appear to be any dialog messages in this range. This range though was define for user defined window classes for adding custom messages unique to the class.

    This range is:

    WM_USER to &H7FFF

    The next range is for custom messages for any window class, which are defined by the user for an individual application. There should be no conflicts with any window classes in this range. It starts at WM_APP (&H8000).

    This range is:

    WM_APP to &HBFFF

    The next range is for messages defined by a string (RegisterWindowMessage) for use by any application. This allows two applications to define the same window message and use the same value for the message. All they have to do is call RegisterWindowMessage with the same string and they both get the same message ID back. This makes the messages defined universal for all apps in the system.

    This range is:

    &HC000 to &HFFFF

    The last range is:

    Greater than &HFFFF

    Which is reserved for future use by the system.

    Leave a comment:


  • Paul Squires
    replied
    Because user defined messages above that number will not collide/conflict with regular Windows messages. You wouldn't want to define a user message that was, say, the same as the WM_COMMAND message number.

    Leave a comment:


  • Fred Buffington
    started a topic Why is %WM_USER used so much ?

    Why is %WM_USER used so much ?

    I see it in snippets as well as source code postings.

    I know that it is 1024 (&H400) but why is it used so much? What are it's advantages ?
Working...
X