Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 902
  • Last Modified:

Modification of window style parameters in MS Visual C++

When a dialogue window, such as a button or an edit box, is created, many of its styles can be set by corresponding edit tools at beginning. My question is how to change those styles in program.

In use of MS Visual C++ V4.x, there are a lot of parameters which can be found in the .rc file, Can they be changed via some functions?

For example, there is a text edit box with an ID of "IDC_TEXT_EDIT" and a style of "ES_READONLY". One line in the .rc file looks like:

EDITTEXT IDC_TEXT_EDIT,110,30,15,12,ES_UPPERCASE|ES_READONLY

Can I set those parameters for their application window just like to set ES_READONLY off or on for a text edit box?
0
ysun
Asked:
ysun
  • 2
  • 2
1 Solution
 
ysunAuthor Commented:
Adjusted points to 50
0
 
skinCommented:
ysun,

Take a look at the member functions for the object you are trying to set the window styles of.  For example in CEdit there is a member function: SetReadOnly that will change this style.
0
 
ysunAuthor Commented:
I know that the SetReadOnly() is a member function of CEdit
and it can change the read-only style.I hope to know how to realized this. That is how to define the object with a "IDC_TEXT_EDIT" ID as CEdit.



0
 
skinCommented:
To associate IDC_TEXT_EDIT with a member of theCEdit class, right click on the edit box and select Class Wizard, then select the Member Variables tab.   Next double click on IDC_TEXT_EDIT in the control IDs column and assign a variable of type CEdit.  Now you'll be able to call SetReadOnly().

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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