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. The Lounge
  3. WM_APP vs WM_USER

WM_APP vs WM_USER

Scheduled Pinned Locked Moved The Lounge
2 Posts 2 Posters 0 Views
  • 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.
  • M Offline
    M Offline
    Masoud Samimi
    wrote on last edited by
    #1

    Hi everybody, I've been looking around for some time, but couldn't find any method or facility to detect the message conflicts in cases of defining user messages with WM_USER and I have been using this method for some long time and haven't had any errors or crash the app! The only article I have is Jeff Prosise's book as Mr. Chris has mentioned it already. So, Is it possible in any way to detect the conflict? :) Thanks everone and especially Mr. Chris to host this discussion. Cheers, Masoud Samimi

    L 1 Reply Last reply
    0
    • M Masoud Samimi

      Hi everybody, I've been looking around for some time, but couldn't find any method or facility to detect the message conflicts in cases of defining user messages with WM_USER and I have been using this method for some long time and haven't had any errors or crash the app! The only article I have is Jeff Prosise's book as Mr. Chris has mentioned it already. So, Is it possible in any way to detect the conflict? :) Thanks everone and especially Mr. Chris to host this discussion. Cheers, Masoud Samimi

      L Offline
      L Offline
      Leo Davidson
      wrote on last edited by
      #2

      I'm not an expert on this, but I think this is true: You can't detect if a given value is already used by a common control because they're just numbers. You can use WM_APP and above which should work, but didn't MS say that about WM_USER? (Or did I just misinterpret the documentation I read which said "use WM_USER and above?) You can use RegisterWindowMessage to allocate yourself a number that should be unique (given nothing is badly behaved), but this uses up some system resources or something like that, so "should be avoided". At the moment, I'm going the RegisterWindowMessage route. BTW, I used WM_USER and above for a while and didn't notice anything wrong for a very long time. Then one of my applications started behaving very strangely and I tracked it down to "my" messages coming from MFC/common controls out of the blue because I'd stumbled on to some numbers that were used for other things. (For example, I had a WM_USER+x message which meant "blah blah has happened, close the window if xyz" and that message was being received every time I gave the window focus, which meant the application appeared to close as soon as it openned! I almost gave up programming when that happened, I couldn't see how it was even possible! hehe So the WM_USER thing may not have bitten you yet, but avoid it before it does!) Hope that's accurate and helpful to ya!

      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

      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups