[comp.windows.ms.programmer] EM_SETMODIFY

memetral@athena.mit.edu (Max E. Metral) (06/25/91)

I am trying to make an edit control read-only.

The parent window is Parent, and the control is EDITCNT.

	SendMessage(EDITCNT, EM_SETMODIFY, FALSE, NULL);
	
	or
	
	SendMessage(Parent, EM_SETMODIFY, FALSE, NULL);

don't work.  What am I doing wrong?  The SDK man never says what value I should
set the flag to to make it read-only...

Thx.
--==<Max Metral>==--

bonneau@hyper.hyper.com (Paul Bonneau) (06/26/91)

In article <1991Jun24.210619.13889@athena.mit.edu> memetral@athena.mit.edu (Max E. Metral) writes:
>I am trying to make an edit control read-only.
>
>The parent window is Parent, and the control is EDITCNT.
>
>	SendMessage(EDITCNT, EM_SETMODIFY, FALSE, NULL);
>	
>	or
>	
>	SendMessage(Parent, EM_SETMODIFY, FALSE, NULL);
>
>don't work.  What am I doing wrong?  The SDK man never says what value I should
>set the flag to to make it read-only...
>
EM_SETMODIFY merely sets (or clears) the "dirty" bit.  This
is set automatically whenever the contents of an edit are
changed.  This allows the app to know if they have been
changed since the last time it looked (by sending
EM_GETMODIFY).

As has been discussed recently, you can subclass the edit and
eat messages that can affect its contents.  These include:
	WM_CHAR,
	WM_CUT,
	WM_COPY,
	WM_PASTE, and
	WM_CLEAR.

cheers - Paul Bonneau.