Re: riched20a with ES_READONLY - can still change formatting ?

JJ <[email protected]> Fri, 27 Mar 2026 03:56:23 +0700
Newsgroups comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general
Organization A noiseless patient Spider
Message-ID <[email protected]>
On Thu, 26 Mar 2026 10:28:08 +0100, R.Wieser wrote:
> JJ,
> 
>> ES_READONLY works fine in both rich-edit and plain-text mode.
> 
> Why ?   Why are you saying that (without any kind of explanation) when I 
> just described how it *doesn't* "work fine" ? :-(
> 
>> Did SetWindowLong() actually succeeded?
> 
> As mentioned, I included the style when defining the control (in the 
> programs resource-file).
> 
> Also, a rich-text box has a EM_SETREADONLY message available.
> 
> https://learn.microsoft.com/en-us/windows/win32/controls/em-setreadonly
> 
> (Remarkably, it says /absolutily nothing/ about why it should be used 
> instead of just changing the GWL_STYLE bit)
> 
> Thanks for reminding me though : I've tested sending that message, but alas, 
> the effect remains the same : I can't edit the text, but can still edit the 
> formatting (even add bullet-points!).
> 
>> Did the style actually been applied?
> 
> Well, as mentioned I can't edit the text itself anymore, which indicates to 
> me that it has.
> 
> But as it so happens I just tested it using GetWindowLong().  It was.
> 
> Regards,
> Rudy Wieser

Oh, I see what you meant.

Though from my tests in Win2000, WinXP, and Win7, the results are a bit
different than yours. Only the line spacing shortcuts (CTRL+1, CTRL+2,
CTRL+5), and Cycle Bullet Style shortcuts (CTRL+SHIFT+L) still able to
change content in read-only mode. All other shortcuts (CTRL+L, CTRL+E,
CTRL+R, CTRL+=, CTRL+SHIFT+=, CTRL+SHIFT+A, etc.) are not able to change
content in read-only mode.

That's a RichEdit bug! Mainly because the read-only feature is partially
functional.

FYI, RichEdit v2.0 which is used in Win9x/ME/NT4 doesn't have any text
formatting keyboard shortcuts yet, so it's likely a bug in RichEdit v3.0+.