• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 639
  • Last Modified:

How many controls will be placed in a Dialog using MFC?>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Hi All,

     Could any one tell that maximum number of controls in a dialog using mfc?

Thanks in Advance
1 Solution
There is no limit. It is limited by the number of windows (controls) the system can handle. I have seen some limitations with that on Windows ME. Otherwise it should be fine.
A dialog with a large number of controls will probably be totally unusable for the user.  (Not many have screen resolution of roughly 16000 x 32000 and a 4m monitor !!!)
I suppose the limit would be set by the number of available dialog item IDs.  Normally they can be reused, and since 0 is forbidden that would limit you to 65,535 (for backwards compatability) or 4,294,967,295 in NT/2000/XP pro.  I can't guess about XP home, though.

However, MFC doesn't reuse dialog IDs, and it starts at 1000 and blocks at, I believe, 32,767.  That would limit you to 31,767 if it is the only dialog, less if there are others.

Hope this helps.
Oh, and if you are generating the dialog items programatically, you can start at one more than the largest pre-existing dialog ID and continue to 32,767 without interrupting any MFC behavior.  After that may work, but I wouldn't count on it . . . MFC is a little messy to know if bugs will show up going outside that range.

Ideally you would create the dialog resource as early as possible so that the control with the largest dialog ID is as small as possible.
Unlimited depends upon the available memory. You have to tweak the MFC resource.h file manually

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now