Windows 11: Notepad Testing?

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
User avatar
lmstearn
Posts: 688
Joined: 11 Aug 2016, 02:32
Contact:

Windows 11: Notepad Testing?

Post by lmstearn » 02 May 2022, 12:13

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.
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH

lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

Re: Windows 11: Notepad Testing?

Post by lexikos » 04 May 2022, 03:05

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

User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Windows 11: Notepad Testing?

Post by jNizM » 04 May 2022, 08:15

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/
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile

Post Reply

Return to “General Discussion”