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

  • SEARCH
  • Home
  • 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 578147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:13:46+00:00 2026-05-13T14:13:46+00:00

How to create dynamic MFC controls and handle message maps of the controls at

  • 0

How to create dynamic MFC controls and handle message maps of the controls at runtime?

  • 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-13T14:13:46+00:00Added an answer on May 13, 2026 at 2:13 pm

    It really depends on which controls do you want to create, especially if you want to know which flags should you set. In general it goes down to this:

    Normally a CWnd-derived control is created using Create or CreateEx. For a CButton, for instance:

    CButton button;
    button.Create("Button text", WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | DT_CENTER, CRect(5, 5, 55, 19), this, nID);
    

    where the CRect specifies the button position, this is a pointer to the parent window, and nID is the control ID.

    If the control doesn’t come out as expected, it’s probably because some flags are missing. I suggest you draw a sample control in design mode, check out the code for that control in the RC file, and copy the flags to the Create caller.

    As for the message maps, they are normally routed to the parent window. The nID value you used in Create is important here, because it will be the number that identifies the control in the message map. If you have a fixed number of controls, you can hard-code the nID numbers for your controls (starting at 10000, for instance); if not, you’ll have to provide a way for the parent window to identify them. Then you just add the message map entries.

    ON_BN_CLICKED(10000, OnBnClicked)
    ON_CONTROL_RANGE(BN_CLICKED, 10010, 10020, OnBtnsClicked)
    

    You can use the ON_CONTROL_RANGE message map to map a range of IDs to the same function.

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

Sidebar

Related Questions

I am needing to create some dynamic controls at Page_Load in the consumer webpart.
I'm trying to create dynamic markers using google maps api and am having problems
I have a page in which I create dynamic controls via OnInit. On the
I am trying to create dynamic controls (Label and combobox) in a WPF form,
i create dynamic textviews in an activity with some fields returned by a webservice.
I create dynamic LinkButton and I add LinkButton's Click Trigger to UpdatePanel. Now, When
How do I create dynamic images using php which depend of $_GET['x'] variables?
I am trying to create dynamic pages without creating new files and getting the
I need to create dynamic INNER JOIN (I believe I need to anyway). I
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =

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.