Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

CWnd::IsWindowEnabled

Specifies whether CWnd is enabled for mouse and keyboard input.

BOOL IsWindowEnabled( ) const;

Return Value

Nonzero if CWnd is enabled; otherwise 0.

Example

//change the background color of an edit control on the dialog
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
   HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

   if ( pWnd->GetDlgCtrlID() == IDC_EDIT1 )
      if ( pWnd->IsWindowEnabled())
      {
         // Red brush for the background...
         pDC->SetBkColor(RGB(255,0,0));
         // m_pRedBrush is the CBrush object initialized with a red brush 
         // using CreateSolidBrush
         return(HBRUSH)m_pRedBrush->GetSafeHandle();
      }
      else
      {
         // Blue brush for the background...
         pDC->SetBkColor(RGB(0, 0, 255));
         // m_pBlueBrush is the CBrush object initialized with a blue 
         // brush using CreateSolidBrush
         return (HBRUSH)m_pBlueBrush->GetSafeHandle();
      }
   return hbr;
}

See Also

CWnd Overview | Class Members | Hierarchy Chart | IsWindowEnabled

Show:
© 2015 Microsoft