AzuLX AzuLX - 4 years ago 283
C++ Question

How do I set Readonly to buttons and textboxes dynamically?

Like while I am initializing the program, I want all my buttons/textboxes to be in a read-only state, but after I'm done they will go back to a clickable state. How can I go about performing this?

Answer Source

Use the EnableWindow() function to enable / disable input to a control. If for example you have a button with a handle of hButton and an edit with a handle of hEdit you can enable the input as follows:

EnableWindow(hButton, TRUE);
EnableWindow(hEdit, TRUE);

To disable the above controls use:

EnableWindow(hButton, FALSE);
EnableWindow(hEdit, FALSE);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download