News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Memory-mangement dilemma

Started by NoCforMe, September 04, 2022, 05:39:29 AM

Previous topic - Next topic

hutch--

 :biggrin:

David,

One of the things you learn about rich edit controls is there are plenty of recipes to get them to work. I personally stick to riched 2 or 3, the earlier one is past it and the later 4 does things that I don't need or want.

NoCforMe

JJ--are you sure about that? I was just looking at that message in MSDN, and they give the parameters as

Parameters
wParam

     HDC for the target device.

lParam

     Line width to use for formatting.


??????
Assembly language programming should be fun. That's why I do it.

TimoVJL

May the source be with you

jj2007

Quote from: NoCforMe on September 05, 2022, 08:25:55 PM
JJ--are you sure about that? I was just looking at that message in MSDN, and they give the parameters as

Parameters
wParam

     HDC for the target device.

lParam

     Line width to use for formatting.


??????

Try Ctrl W in RichMasm.

NoCforMe

OK, so we're relying on an Undocumented Feature here. Hopefully won't get broken in the next version of Windoze. (Hello, Raymond Chen!)
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: TimoVJL on September 05, 2022, 09:10:24 PM
Perhaps it is an undocumented special feature, but wine had it.

richedit: Added support for EM_SETTARGETDEVICE with a NULL DC

REACTOS:
Quote"EM_SETTARGETDEVICE doesn't use non-NULL target devices\n"

It is not documented, but everybody uses the null DC - for the screen, not for printers.

NoCforMe

[caution: possible thread drift ahead]

I'm confused here. Isn't the (stated) purpose of this message to render RichEdit text on a device (presumably a printer) in a WYSIWYG manner?

If so, then how could it possibly only work on a NULL DC? Is the MSDN documentation totally off here?

Here's one of Raymond Chen's blog entries in which he explains how to print RichEdit text. His code uses this message for its stated purpose. (Of course, this was written in 2007; maybe things have changed since then?) So maybe there's the intended behavior and the undocumented functionality.

Also, I looked at that ReactOS page and I'm really curious: what exactly is that project? They seem to be examining stuff in the OS to see if it works or not, or maybe I'm missing something here. (Hmm; maybe it has something to do with Doxygen. But then, what is that? something about "Generat[ing] documentation from source code".)

Anyhow, if EM_SETTARGETDEVICE works for you to toggle word-wrapping in a RichEdit control, then I'm game to try it.
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on September 06, 2022, 06:55:03 AMI'm confused here. Isn't the (stated) purpose of this message to render RichEdit text on a device (presumably a printer) in a WYSIWYG manner?

Sure. A line length of 1 means "don't even try to wrap that" :cool:

QuoteIf so, then how could it possibly only work on a NULL DC? Is the MSDN documentation totally off here?

MSDN doesn't mention that option. I vaguely remember to have seen that Windows replaces a NULL DC with the screen DC but can't find it.

RichEdit is a wonderful control, but it has its quirks.

Quote from: murrays on April 19, 2017, 09:17:33 AM
Please don't use Windows' riched20.dll. It's only there for compatibility with ancient code. Upgrade to msftedit.dll. It's modern, fast, but doesn't yet support math. Hopefully soon. It did for a while in the Windows 8 beta, but then somebody disabled it  :( The Office riched20.dll is the best version at the moment. RichEdit runs on iOS, Mac, Android, Windows and WinRT. It supports math and now supports LaTeX math input/output as well. My Math in Office blog will have a post on it soon.

hutch--

#53
It really depends on what you want out of a rich edit control. Version 1 is past it but worked OK at the time, version 2 - 3 has been around for a long time and while it is not without its quirks, I find it useful, mainly for plain text for code editors but it also handles RTF well enough in terms of colour and fonts and formatting, the reason why I have used it in my latest help file format.

I have no real interest in emulating a word processor or a spread sheet so much of the extra things the latest version does are no use to me.

What some may find is that there are a number of people here who have been writing text editors for a very long time, in my own case, I wrote my own editors back in 16 bit Windows in Microsoft C and later in GFA basic. In 32 bit Windows I wrote them in PowerBASIC and later in 32 bit MASM. In 64 bit, 64 bit MASM is the latest.

I am pleased to see other people also writing rich edit based editors but they need to realise that others have done it as well and for a very long time. No-one is taking the piss out of you when they comment on how to improve certain types of code or know another way that works better, its one of the things that a forum of this type is good at, passing on know how rather than hiding it.

jj2007

Quote from: hutch-- on September 06, 2022, 08:41:23 AMI wrote my own editors back in 16 bit Windows in Microsoft C and later in GFA basic.

I wrote my first word processor in GfaBasic on the Atari ST, around 1986. It had advanced search facilities, and I could embed graphics. Once I wrote a scientific book with it, and it got accepted "as is" by a renowned publishing house, graphics included. I wrote the screen and printer drivers in 68000 Assembly. It still works fine on this machine, using the Steem emulator.

Quote from: hutch-- on September 06, 2022, 08:41:23 AMNo-one is taking the piss out of you when they comment on how to improve certain types of code or know another way that works better, its one of the things that a forum of this type is good at, passing on know how rather than hiding it.

:thumbsup:

daydreamer

my interest in learn foreign languages I tested unicode rich edit with japanese and arabic,I read that there are rich edit version on asian windows to support the vertical japanese writing
arabic vs western there is need to reverse string when convert from text written in western alphabet to arabic unicode,could be as much as a whole book is reversed
I have choosed to concentrate on learn japanese as third language




my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

TimoVJL

richedit from 2.0 is internally UNICODE ?
how to check it ?
May the source be with you

hutch--

Japanese is reasonably straight forward in UNICODE, Win10 has the fonts and rich edit 2 - 3 will display it correctly. Arabic and Hebrew are a lot more complicated as right to left notation, you may need an Arabic or Hebrew version of Windows to be able to enter characters. May also be the case if you want to use the keyboard for Japanese. Its in the reference material.

jj2007

Win7 can display Arabic, Chinese etc., see RichMasm menu Autocode/strings

hutch--

Back in win98se, if you downloaded the asian fonts you could do most languages. Win2000 was better and XP was better again. Its been that long since I seriously ran in7 64 bit that I forget what it would do. (I installed Win7 64 on a recent computer a year os so ago but immediately overinstalled Win 10 64. It was just to use the Win7 64 serial number as it was a retail black edition.