-1

I am trying to find information on how to code a selectedtext event handler with C# UI automation and notepad. A google search only turned up the following article:

https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-handlingtextrelatedevents

I have not been able to find any code examples for this. Any help would be appreciated.

Weston Goodwin
  • 781
  • 3
  • 12
  • Are you trying to code C# with notepad? If yes, then it's a bad idea and you need to go through basics of C# from the very beginning before you do some work on automation. – Constantine Ketskalo Aug 12 '21 at 17:13
  • @ConstantineKetskalo Let me clarify the question. I am not trying to code C# with notepad. I am trying to use the selected text UI automation on notepad to determine if the user has a word highlighted. – Weston Goodwin Aug 12 '21 at 18:03

1 Answers1

0

I'm not sure if you can test WinApi application using just C#. Probably you'll need to add some C++ code there. Also your link leads to some other related links and they contain some peaces of code. It's just looks like there's no ready solution at MSDN for your question. You'll need to find element first, then subscribe your handler to that event that you want for that particular element. In your case text input of notepad. Probably googling something related to testing WinApi applications might be helpful.