• riched20a with ES_READONLY - can still change formatting ?

    From R.Wieser@address@is.invalid to comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general on Wed Mar 25 19:49:26 2026
    From Newsgroup: alt.windows7.general

    Hello all,

    Programming related :

    I've got a simple dialog on which I placed a riched20a control which I have given, among others, the ES_READONLY style. The result is that I cannot
    edit the text itself. Which is what I was after.

    However, I was rather surprised to discover that some shortcut-keys
    affecting text-formatting (ctrl-R, ctrl-L and likely more) still work. :-(

    Question : How do I make the text *really* read-only ? *inclusive* text-formatting.

    Is that possible at all ? Which style would I need to add/remove / which GWL_* bit would I need to set/clear (I've not seen anything in that regard)
    ?

    Remark: I need to be able to select-and-copy text from it though. Using the mouse or keyboard.

    Regards,
    Rudy Wieser


    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From ManiFold@invalid@invalid.invalid to alt.windows7.general on Wed Mar 25 22:49:15 2026
    From Newsgroup: alt.windows7.general

    On 25/03/2026 18:49, R.Wieser wrote:

    Programming related :

    Which language and version?

    XP had many languages - C#, VB, C, C++ so pick one and repost.

    I know how C# works and you can certainly change the label text and make textBox readOnly.




    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From R.Wieser@address@is.invalid to comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general on Thu Mar 26 07:53:51 2026
    From Newsgroup: alt.windows7.general

    ManiFold,

    Programming related :

    Which language and version?

    I think you misunderstood. I'm asking about the RichEdit20 control, as provided by RichEd20.dll. Not about some language-specific wrapper using
    it.

    I know how C# works and you can certainly change the label
    text and make textBox readOnly.

    As mentioned, I already made the richedit textbox read-only.

    The problem is that I can still change, by pressing a key or two, the text-formatting - which I don't want to happen either.

    For the record: The language I'm using is Assembly.

    Regards,
    Rudy Wieser

    p.s.
    Why did you remove the other two newsgroups (I re-added them) ? You effectivily changed a cross-post to a multi-post (which is bad).


    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From JJ@jj4public@gmail.com to comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general on Thu Mar 26 15:12:15 2026
    From Newsgroup: alt.windows7.general

    On Wed, 25 Mar 2026 19:49:26 +0100, R.Wieser wrote:
    Hello all,

    Programming related :

    I've got a simple dialog on which I placed a riched20a control which I have given, among others, the ES_READONLY style. The result is that I cannot edit the text itself. Which is what I was after.

    However, I was rather surprised to discover that some shortcut-keys affecting text-formatting (ctrl-R, ctrl-L and likely more) still work. :-(

    Question : How do I make the text *really* read-only ? *inclusive* text-formatting.

    Is that possible at all ? Which style would I need to add/remove / which GWL_* bit would I need to set/clear (I've not seen anything in that regard) ?

    Remark: I need to be able to select-and-copy text from it though. Using the mouse or keyboard.

    Regards,
    Rudy Wieser

    ES_READONLY works fine in both rich-edit and plain-text mode.

    Did SetWindowLong() actually succeeded? Did the style actually been applied? --- Synchronet 3.21f-Linux NewsLink 1.2
  • From R.Wieser@address@is.invalid to comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general on Thu Mar 26 10:28:08 2026
    From Newsgroup: alt.windows7.general

    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


    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Zaidy036@Zaidy036@air.isp.spam to comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general on Thu Mar 26 10:23:59 2026
    From Newsgroup: alt.windows7.general

    On 3/25/2026 2:49 PM, R.Wieser wrote:
    Hello all,

    Programming related :

    I've got a simple dialog on which I placed a riched20a control which I have given, among others, the ES_READONLY style. The result is that I cannot
    edit the text itself. Which is what I was after.

    However, I was rather surprised to discover that some shortcut-keys
    affecting text-formatting (ctrl-R, ctrl-L and likely more) still work. :-(

    Question : How do I make the text *really* read-only ? *inclusive* text-formatting.

    Is that possible at all ? Which style would I need to add/remove / which GWL_* bit would I need to set/clear (I've not seen anything in that regard)
    ?

    Remark: I need to be able to select-and-copy text from it though. Using the mouse or keyboard.

    Regards,
    Rudy Wieser


    Convert to jpg, pdf? Overlay with transparent level?
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From R.Wieser@address@is.invalid to comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general on Thu Mar 26 15:39:23 2026
    From Newsgroup: alt.windows7.general

    Zaidy036,

    Question : How do I make the text *really* read-only ? *inclusive*
    text-formatting.
    ...
    Convert to jpg, pdf? Overlay with transparent level?

    Rube goldberg machine much ? (look it up)

    Regards,
    Rudy Wieser


    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From JJ@jj4public@gmail.com to comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general on Fri Mar 27 03:56:23 2026
    From Newsgroup: alt.windows7.general

    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+.
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From R.Wieser@address@is.invalid to comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general on Fri Mar 27 08:20:39 2026
    From Newsgroup: alt.windows7.general

    JJ,

    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.

    I'm running XPsp3, and for me CTRL-R, CTRL-L, CTRL-E and CTRL-R certainly do work in read-only mode.

    I just tested, I read-only mode, CTRL-+ (superscript), and it was indeed blocked. Hmmm...

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

    It certainly does seem that the read-only feature is only partly functional (which feels more wrong than not functional at all). I wonder if thats a
    normal bug, or a bug-with-seniority (aka: feature). :-)


    Bottom line, its not a case of me not knowing and not being able to find the setting for disabeling the text-formatting keys, it looks to be a bug.

    Bummer. Now I have to go and subclass that control to catch and filter the WM_KEYDOWN messages. :-|

    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+.

    In my resource-definition I'm specifying "RichEdit20A" (text, not a
    constant). Although, thats using an XPsp3 2008 RICHED20.DLL, which contains both the v2.0 and v3.0 versions.

    Regards,
    Rudy Wieser


    --- Synchronet 3.21f-Linux NewsLink 1.2