read,write,modify while texteditor is open

时间:2018-06-04 16:57:20

标签: c#

after one hour searching I'm writing this question. how to read,write and modify a text in text editor while the text editor is open, the text editor might be anything such as notepad or vs or word. the type of c# application isn't matter whatever it be.

2 个答案:

答案 0 :(得分:0)

You need to connect to the process, it involves a lot of Windows API and it is different for different applications. My advise, don't do it, I cannot imagine an architecture which includes this kind of actions, it is asking for bugs.

But, if you still want to do it, Google: "connect to a process notepad and change text c#"

You will find many links which explain. For example this one: https://www.codeproject.com/Articles/670373/Csharp-Read-Write-Another-Process-Memory

答案 1 :(得分:0)

写入另一个记忆的过程更复杂,更不稳定。更好的想法是将消息/事件发送到另一个进程。 This链接演示了记事本,但其他编辑的想法相似。