Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7661325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:34:59+00:00 2026-05-31T13:34:59+00:00

I have a custom Windows controls that superclass standard ones. I would like my

  • 0

I have a custom Windows controls that superclass standard ones. I would like my custom controls to notify its parent window of certain events. What’s the best practice for doing so?

  • Send the parent window a window message in the WM_USER or WM_APP range. This won’t work since the values could collide if another child control tried the same thing.

  • Send the parent window WM_NOTIFY. This seems like the right thing to do, but since I’m extending a standard Windows control, how can I ensure that the notification code I use won’t collide with one normally sent by the base class (now or in the future)?

  • Send the parent window a window message from RegisterWindowMessage. This should be sufficient to avoid unintentional collisions, but Microsoft recommends using it only for inter-process messages.

  • Have the control provide a mechanism for the application to specify what WM_APP message to use for notifications. This seems like the only robust approach, but it also feels a bit like overkill. (Or, instead of specifying a window message, I suppose that the application could pass down a function pointer.)

I’ve seen a similar question, but the sole answer there is tied to MFC and doesn’t really address avoiding collisions.

What do other people usually do? Do they use one of the first three approaches and not worry about it? I’d like my controls to be suitable for broader consumption outside of my application, so I’d also prefer using standard Win32.

Edit: Tried to clarify what I’m looking for.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:35:00+00:00Added an answer on May 31, 2026 at 1:35 pm

    So I noticed that the notification code ranges defined in CommCtrl.h all look like:

    #define NM_FIRST                (0U-  0U)       // generic to all controls
    #define NM_LAST                 (0U- 99U)
    ...
    #define TRBN_FIRST              (0U-1501U)       // trackbar
    #define TRBN_LAST               (0U-1519U)
    

    So Microsoft’s common controls at least have defined ranges (and are likely to always be large unsigned values). Therefore if I super- or subclass standard controls and use notification codes incrementing from 0, I think that I should be safe against current and future versions of Windows.

    (If I were deriving from third-party controls, then those third-party controls would need to define their own reserved ranges. Otherwise all bets would be off.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one main windows form and within that form I have custom controls
I have a WPF Window that has a custom border, Thumb controls for resizing,
In the Windows applications I work on, we have a custom framework that sits
I have a windows service that has a custom configuration section. In the configSectionHandler
I have a custom control for a LayoutPanel that holds child controls. I want
I have a Windows Form that contains a custom control container as a UserControl.
We have a custom canvas which has specialized nodes that behave a lot like
I have created a custom control that inherits System.Windows.Forms.Panel, and adds a few extra
I have a custom control: it's managed code, which subclasses System.Windows.Forms.Control. I want to
I have a custom user control on my windows forms. This control has a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.