How to lock an edit box?

This is a discussion on How to lock an edit box? within the Windows Programming forums, part of the Platform Specific Boards category; Hi, all I want to create an edit box and have it locked (not disable), so the content (the text) ...

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    162

    How to lock an edit box?

    Hi, all

    I want to create an edit box and have it locked (not disable), so the content (the text) in the control can still be selected but not modified/edited. I am using regular Windows API, no MFC.

    Thanks in advance
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Create the edit box with the ES_READONLY style.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    162
    But I want to be able to lock and unlock the edit box during runtime. Isn't there any window message that could be sent?

    Edit:
    Sorry I should have mentioned that earlier
    Last edited by Aidman; 07-27-2003 at 10:46 AM.
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

  4. #4
    Registered User
    Join Date
    Dec 2002
    Posts
    162
    Wuppy

    I found it, the EM_SETREADONLY message.
    Thanks adrianxw, it was your tip on ES_READONLY that helped me find it
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. edit box
    By beene in forum Windows Programming
    Replies: 3
    Last Post: 11-11-2006, 04:40 AM
  2. WS_HSCROLL in ES_READONLY edit box error
    By Homunculus in forum Windows Programming
    Replies: 4
    Last Post: 02-13-2006, 08:46 AM
  3. How to program a "back" button with MFC
    By 99atlantic in forum Windows Programming
    Replies: 3
    Last Post: 04-26-2005, 09:34 PM
  4. display a file in dropdown edit box
    By sunburnbyRA in forum Windows Programming
    Replies: 2
    Last Post: 03-10-2004, 01:58 PM
  5. Edit box question
    By learning110 in forum Windows Programming
    Replies: 6
    Last Post: 03-28-2003, 08:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21