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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CWnd::Create question.

CWnd::Create question.

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
2 Posts 2 Posters 0 Views 1 Watching
  • 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.
  • B Offline
    B Offline
    Brian van der Beek
    wrote on last edited by
    #1

    The Create function of the MFC CWnd class has a parameter for the ID of window/control. (Almost) all CWnd derived classes have such a parameter. When I create a control dynamically, do I have to specify a correct ID or can I just fill in any value (e.g. 0 or -1)? Is this ID actually used? and if so, for what is it used and how do I obtain the next available ID?

    M 1 Reply Last reply
    0
    • B Brian van der Beek

      The Create function of the MFC CWnd class has a parameter for the ID of window/control. (Almost) all CWnd derived classes have such a parameter. When I create a control dynamically, do I have to specify a correct ID or can I just fill in any value (e.g. 0 or -1)? Is this ID actually used? and if so, for what is it used and how do I obtain the next available ID?

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      You can specify any ID you want to. The normal ID used for 'don't care' is IDC_STATIC (-1). The ID will be used if you want to retrieve the control by its ID, such as when calling GetDlgItem, GetDlgItemText, SetDlgItemText, etc. The only way you could get the 'next available ID' would be to walk the window's child controls using GetWindow (get the first with GW_CHILD, then use GW_HWNDNEXT to get subsequent children) calling GetDlgCtrlID on each one.

      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

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups