Page 1 of 1

Windows 11: Notepad Testing?

Posted: 02 May 2022, 12:13
by lmstearn
The Notepad.exe of old has been the tester, sandbox guy, guinea prg, and general all round playpal for AHK users for years now. It's not a default app in W11, apparently, so what's the best way forward in W11? Its replacement, Notepad W11, is a UWP app, upon which AHK script testing may not be so reliable anymore (example here).

Encourage users to either add it via Optional Features as suggested here, acquire it from the Windows Store, or bundle in a facsimile build with the AHK executable files. The last option might be a good idea for a lightweight AHK package, aiming for a build size under 100k (Notepad is 200k).
Windows Console might be another possibility, or even some of the old Win95/98 Terminal emulators come to mind. Notepad has always been the peoples' choice because it can open any file type and run in any instance.

Re: Windows 11: Notepad Testing?

Posted: 04 May 2022, 03:05
by lexikos
The Notepad.exe of old has been the tester, sandbox guy, guinea prg, and general all round playpal for AHK users for years now. It's not a default app in W11, apparently, so what's the best way forward in W11?
That's a good question.

Another example: ControlSend[Raw], example 1 not working on latest Windows 11 build · Issue #537 · Lexikos/AutoHotkey_L-Docs · GitHub

The new Notepad is installed by default in Windows 11, but it differs from the old Notepad in significant ways, and can be removed. It is what Microsoft calls an "inbox app" because it "comes in the box".
add it via Optional Features as suggested here,
I wasn't aware of this. Running notepad.exe from any system folders still opens the new Notepad. The description of this feature suggests that removing the new Notepad would allow the classic Notepad to open. So I merely right clicked Notepad in Start search and clicked Uninstall; now I have Notepad back. It opened with a banner at the top telling me "a new version of Notepad is available", but I dismissed it and it did not return when I restarted Notepad. There is a registry value in an obvious location which enables/disables the banner.


As a target for examples, "Windows Console" (presumably you mean the normal window shown by any console app) is in the same boat as Notepad. Windows 11 has a setting for "the default terminal app to host the user interface for command-line applications". I have it set to Windows Terminal, so if I run cmd.exe, for instance, I get a window that is owned by WindowsTerminal.exe, not a classic console window owned by cmd.exe.

A classic console window still appears if I call DllCall("AllocConsole"), but if the script is launched from within SciTE, no console window appears (and this isn't new).

Re: Windows 11: Notepad Testing?

Posted: 04 May 2022, 08:15
by jNizM
It is a RichEditD2DPT Control now
In January 2020, the Microsoft 365 RichEdit introduced a D2D/DirectWrite RichEdit window control with the new window classes “RichEditD2D” and “RichEditD2DPT”. They use D2D/DirectWrite for text and images and the window’s HDC for rendering embedded objects and printing. The Windows 11 Notepad uses the RichEditD2DPT window class with a recent Microsoft 365 RichEdit.
https://devblogs.microsoft.com/math-in-office/windows-11-notepad/
https://devblogs.microsoft.com/math-in-office/richeditd2d-window-controls/