CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2019
    Posts
    2

    Are EnableWindow and SetReadOnly mutually exclusive?

    I have an edit box that, initially at the creation of this program, was set to be disabled under most circumstances. Disabling the box disabled all controls as well, which was problematic because the scrollbar would be inactive despite there sometimes being a large amount of text in these boxes. My fix was to instead change these boxes to read only in the situations that they were originally disabled. For knowledge sake, I'm wanting to ensure that these two functions are exclusive. For example, when I disable a box first then immediately after try to set it to read only, the box never changes. It stays disabled. So it made me curious of how this actually works (for what it's worth, I'm extremely naive when it comes to most things MFC).

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Are EnableWindow and SetReadOnly mutually exclusive?

    1. It has nothing to do with MFC. It is just plain Win32:
    EnableWindow(controlHandle, TRUE) / EnableWindow(controlHandle, FALSE) - to enable/disable control window.
    SendMessage(controlHandle, EM_SETREADONLY , TRUE) / SendMessage(controlHandle, EM_SETREADONLY , TRUE) - to set/reset edit control readonly.
    2. As you see these two operations are independent.
    Victor Nijegorodov

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Are EnableWindow and SetReadOnly mutually exclusive?

    Btw, MFC window related classes are simply classes that wrap native Win32 window functionality.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured