简体   繁体   English

如何在SSMS插件中获取活动窗口的全文?

[英]How can I get the full text of the active window in an SSMS addin?

I'm attempting to get the text of the active window in SSMS via an addin developed through VS2012. 我正在尝试通过VS2012开发的插件来获取SSMS中活动窗口的文本。 I can see the EnvDTE.Window.Selection property contains some information on the selected text, but I also want to be able to access the full text. 我可以看到EnvDTE.Window.Selection属性包含有关所选文本的一些信息,但我也希望能够访问全文。

  1. Anyone know how this is possible? 有人知道这怎么可能吗?
  2. Does anyone also know how you can set the text of the active window, both selected and full text? 有谁知道如何设置活动窗口的文本,包括选定文本和全文?

Thanks 谢谢

Found the answers: 找到了答案:

  1. You can set the text by simply assigning the Text property. 您可以通过简单地分配Text属性来设置文本 Be warned that it gets a little weird with some formatting it automatically does. 请注意,它会自动进行某些格式化,这有点奇怪。
  2. You can just do a SelectAll call and then access the Text property to get all of the text on the active window. 您可以只执行一次SelectAll调用,然后访问Text属性以获取活动窗口上的所有文本。
  3. The type of object returned by the Selection property is a TextSelection object. Selection属性返回的对象类型是TextSelection对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM