Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 12: Dialog-Based Windows Visual C++ and MFC Fundamentals


= 5800 0000

BOOL EnableWindow(BOOL bEnable = TRUE);

Practical Learning: Disabling a Control



  1. To disable the custom control, change its style to a value of 0x58000000

  2. Test the application and trying typing in the edit box again

  3. Close it and return to MSVC


11.4.4..Borders..................................................................................................


One of the visual features you can give a control is to draw its borders. As it happens,
most Microsoft Windows controls have a 3-D look by default. Some other controls must
explicitly be given a border. To add a border to a control, at design time, set its Border
property to True. If you are programmatically creating the control, add the
WS_BORDER style to it:

void CSecondDlg::OnSecondControl()
{
// TODO: Add your control notification handler code here
CWnd *Second = new CWnd;

Second->Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, );
}

The border style is defined as:

#define WS_BORDER 0x00800000L

To raised the borders of such a control, add the WS_THICKFRAME to its styles:

BOOL CBordersDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
CtrlBorders->Create(NULL, NULL,
WS_CHILD | WS_VISIBLE | WS_THICKFRAME, );

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
Free download pdf