Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for writing to new Notepad on Windows 11 #59

Open
bstordrup opened this issue May 11, 2023 · 4 comments · May be fixed by #60
Open

Add support for writing to new Notepad on Windows 11 #59

bstordrup opened this issue May 11, 2023 · 4 comments · May be fixed by #60
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@bstordrup
Copy link

I have experienced that the current implementation of finding the notepadEditorHandle on Winodows 11 with the RichEditD2DTP class does not find the actual editor handle.

But by enumerating the child windows from the process MainWindowHandle, I do find it.

I'll make a pull request for this issue with my changes.

@augustoproiete
Copy link
Member

Excellent. Thanks @bstordrup

@bstordrup
Copy link
Author

@augustoproiete, some complications. I do get a handle to a RichEditD2DTP window, but the text is never shown there. Digging further into it.

@bstordrup
Copy link
Author

OK. Found the issue. It seems like there has been a change in the structure of Notepad. I think it might be an internal structuring change in the application.

The version of Notepad that I have supports multiple documents in the same instance, so the RichEditD2DPT is not a direct child of the MainWindowHandle - it is located inside another window with ClassName "NotepatTextBox".

The structure is illustrated on the image.

  • Entry 0 is the main window with class name Notepad
  • Entry 4 is a window with class name NotepadTextBox. Parent window is Entry 0
  • Entry 5 is a window with class name RichEditD2PDT. Parent window is Entry 4.

I think earlier, RichEditD2PDT had the Main window a direct parent. So my change is that if I do not find a window handle by the direct FindWindowEx call with RichEditD2DPT, the child windows below MainWindowHandle is enumerated and the RichEditD2DPT handle is returned.

image

@bstordrup
Copy link
Author

A new issue now is that the Notepad application can have multiple documents open, and hence have multiple entries in the list with class name RichEditD2DPT. Then which one should be selected? It seems like the last one opened is the first one being found, so returning that one should be safe.

@augustoproiete augustoproiete added the enhancement New feature or request label May 17, 2023
@augustoproiete augustoproiete changed the title Finding editor handle on recent Windows 11 Notepad Add support for writing to new Notepad on Windows 11 Jun 4, 2023
@augustoproiete augustoproiete added this to the v3.1.0 milestone Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

2 participants