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. General Programming
  3. C / C++ / MFC
  4. enum { IDD = IDD_DIALOG};

enum { IDD = IDD_DIALOG};

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 Posts 6 Posters 3 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.
  • K Offline
    K Offline
    Kiran Pinjala
    wrote on last edited by
    #1

    why dialog box ID is enumerated as the IDD member? Is there any special reason that it is enumerated?

    KIRAN PINJARLA

    S Steve EcholsS B 3 Replies Last reply
    0
    • K Kiran Pinjala

      why dialog box ID is enumerated as the IDD member? Is there any special reason that it is enumerated?

      KIRAN PINJARLA

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      Because macros suck, unless there in no better solution. In this case there is. For example, macros can't be class members but an enum can (and in this case is).

      Steve

      N 1 Reply Last reply
      0
      • K Kiran Pinjala

        why dialog box ID is enumerated as the IDD member? Is there any special reason that it is enumerated?

        KIRAN PINJARLA

        Steve EcholsS Offline
        Steve EcholsS Offline
        Steve Echols
        wrote on last edited by
        #3

        Not exactly sure, but I think has mostly to do with the wizards that create the dialog classes, because as far as I can tell, IDD is is only passed to the constructor of CDialog as the resource ID. I could be way wrong of course...


        - S 50 cups of coffee and you know it's on!

        • S
          50 cups of coffee and you know it's on!
          Code, follow, or get out of the way.
        1 Reply Last reply
        0
        • S Stephen Hewitt

          Because macros suck, unless there in no better solution. In this case there is. For example, macros can't be class members but an enum can (and in this case is).

          Steve

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          Stephen Hewitt wrote:

          Because macros suck,

          :| Why? If we use macros carefully they are very helpful. Mainly because of irrational use most of the BUGs happen. For me macros are indispensable.


          Nibu thomas A Developer Programming tips[^]  My site[^]

          S 1 Reply Last reply
          0
          • K Kiran Pinjala

            why dialog box ID is enumerated as the IDD member? Is there any special reason that it is enumerated?

            KIRAN PINJARLA

            B Offline
            B Offline
            benjymous
            wrote on last edited by
            #5

            It's how the Class Wizard recognises and remembers which classes are tied to which dialogs. If you remove that line, Class Wizard won't recognise which dialog belongs to the class any more.

            -- Help me! I'm turning into a grapefruit! Buzzwords!

            T 1 Reply Last reply
            0
            • N Nibu babu thomas

              Stephen Hewitt wrote:

              Because macros suck,

              :| Why? If we use macros carefully they are very helpful. Mainly because of irrational use most of the BUGs happen. For me macros are indispensable.


              Nibu thomas A Developer Programming tips[^]  My site[^]

              S Offline
              S Offline
              Stephen Hewitt
              wrote on last edited by
              #6

              As I said, if there is no better solution macros are fine. But there are many problems with them and they’re overused by many C/C++ programmers. Some of the problems with them are: - Can’t be overloaded. - Make debugging harder. - Don’t obey C/C++ scoping rules. - Can cause nasty side effects. All of these problems with macros – and more besides – are well known.

              Steve

              N 1 Reply Last reply
              0
              • S Stephen Hewitt

                As I said, if there is no better solution macros are fine. But there are many problems with them and they’re overused by many C/C++ programmers. Some of the problems with them are: - Can’t be overloaded. - Make debugging harder. - Don’t obey C/C++ scoping rules. - Can cause nasty side effects. All of these problems with macros – and more besides – are well known.

                Steve

                N Offline
                N Offline
                Nibu babu thomas
                wrote on last edited by
                #7

                Stephen Hewitt wrote:

                - Can’t be overloaded.

                They are not meant to be overloaded. If that's the purpose there are functions we should use them.

                Stephen Hewitt wrote:

                - Make debugging harder.

                TRUE.

                Stephen Hewitt wrote:

                - Don’t obey C/C++ scoping rules.

                Macros were not made for this purpose. They acts as just pure inline code replacement routine. If not used carefully ....

                Stephen Hewitt wrote:

                - Can cause nasty side effects.

                TRUE. They should be extremely well written. :)


                Nibu thomas A Developer Programming tips[^]  My site[^]

                1 Reply Last reply
                0
                • B benjymous

                  It's how the Class Wizard recognises and remembers which classes are tied to which dialogs. If you remove that line, Class Wizard won't recognise which dialog belongs to the class any more.

                  -- Help me! I'm turning into a grapefruit! Buzzwords!

                  T Offline
                  T Offline
                  TheCPUWizard
                  wrote on last edited by
                  #8

                  Yup, and this now ties the resource file (with every resource) to the header, so any user of the header had to re-compile, any time any resource element changes, no matter how unrelated....

                  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