How to launch a process which will open a text file in any editor and automatically move cursor to a certain line number?

后端 未结 3 591
长情又很酷
长情又很酷 2021-01-05 04:22

From c#, I want to launch a process which will open a text file in any editor and automatically move cursor to a certain line number.

I can open a file using

3条回答
  •  不知归路
    2021-01-05 04:47

    The solution very heavily depends on which process/editor is opened on your system. That editor would have to have a developer API that you could use to access functionality such as setting ranges and altering the cursor position. For example, if the editor that is opened is Microsoft Word, you would use the Word Interop API to set a selection at a specific position. There is no universal way to do this in 'any editor' since each one has its own API (or no outward facing API at all).

提交回复
热议问题