Jump to content

A question about MFC class

- - - - -

  • Please log in to reply
2 replies to this topic

#1
gaconga1105

gaconga1105

    Newbie

  • Members
  • Pip
  • 5 posts
In MFC programming, any added resource has its own ID,
ex:
#define IDD_DIALOG 105

and the class also has an enum to specify it (I think),
ex:

class MyDialog : public CDialog

{

  public:

   enum { IDD = IDD_DIALOG}

}

     

I wondered that, if we have to create tons of different Dialogs, or simpler, Buttons, we also have to create tons of different class with tons of different enum??? :confused:

This may be a stupid question, but thanks for any help
Bim Bim

#2
Ancient Dragon

Ancient Dragon

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 400 posts
Microsoft compilers IDE such as VC++ 2010 handles all that for you. When you add a button to a dialog the IDE will generate the ID for you. You don't have to manually create all that stuff.
Visit Grandpa's Forums, a social networking forum, with family-oriented arcade games, blogs, discussion forums, and photo albums.

#3
kernelcoder

kernelcoder

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 282 posts
  • Location:Dhaka
  • Programming Language:C, Java, C++, C#, Visual Basic .NET
  • Learning:Objective-C, PHP, Python, Delphi/Object Pascal
That practice is a pattern in MFC. So, I think if you have time to create tons of classes, you would have time to define an enum for that class.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users