add-in

Get the reference of the DTE2 object in Visual C# 2010

醉酒当歌 提交于 2019-11-27 01:40:49
问题 I want to get a reference to the current solution, using the DTE2 object with C# in Visual Studio 2010. I first tried the following code: var dte = Marshal.GetActiveObject("VisualStudio.DTE.10.0") as EnvDTE80.DTE2; But when I open 2 solutions, and this code is in the first solution, I get NOT a reference to the current solution, but a reference to the last solution I loaded. I need the current solution... Searching on the internet, I found the following solution in How do you get the current

How to load plugins in .NET?

▼魔方 西西 提交于 2019-11-27 00:14:47
问题 I'd like to provide some way of creating dynamically loadable plugins in my software. Typical way to do this is using the LoadLibrary WinAPI function to load a dll and calling GetProcAddress to get an pointer to a function inside that dll. My question is how do I dynamically load a plugin in C#/.Net application? 回答1: The following code snippet (C#) constructs an instance of any concrete classes derived from Base found in class libraries (*.dll) in the application path and stores them in a

Find an IVsTextView or IWpfTextView for a given ProjectItem, in VS 2010 RC extension

匆匆过客 提交于 2019-11-26 20:43:36
问题 I have the ProjectItem, and want to get the IWPFTextView that is associated with it, if any. I have tried to get an IVsTextManager, and then iterate through the views, but iVsTextManager.EnumViews always returns nothing. Here is what I've got so far: var txtMgr = (IVsTextManager)Package.GetGlobalService(typeof(SVsTextManager)); if (txtMgr != null) { IVsEnumTextViews iVsEnumTextViews; IVsTextView[] views = null; // Passing null will return all available views, at least according to the

Get a list of Solution/Project Files for VS Add-in or DXCore Plugin

混江龙づ霸主 提交于 2019-11-26 20:06:09
问题 I am trying to write a add-in for Visual Studio that, among other things, needs to keep track of every file in a Visual Studio solution. I know what events I need to subscribe to (when a Solution is opened, when a file is added/removed/edited in it, the same for projects, etc), but I don't understand how to actually get a list of files from any of it. I recently installed CodeRush and have been playing with the DXCore framework. I'm very happy with it's approach at plugins, but I still don't

Build add-in for VBA IDE using VB.NET

ⅰ亾dé卋堺 提交于 2019-11-26 19:21:16
问题 I have asked this elsewhere, but have never found anyone knows how to build an add-in for VBA IDE using VB.NET. Is it even possible? Could someone point me to an example? 回答1: It is possible you need to write a com addin using IDTExtensibility2 interface, select the shared addin project template from new project. EDIT Otherwise to create this addin from scratch you will need to do the following: Create a new project class library Add references to "Extensibility", it should be in the list.

Outlook 2010 Com addin - NewExplorer never fires

走远了吗. 提交于 2019-11-26 18:37:20
问题 For some reason in my app my FolderSwitch works on the main Explorer that opens with the application but the NewExplorer event never fires, so obviously the FolderSwitch event won't fire on a new Explorer. I can't work out why the event doesn't fire. private List<_Outlook.Explorer> ListOfExplorerWindows = new List<_Outlook.Explorer> { }; private _Outlook.Application Application; public void OnConnection(object Application, Extensibility.ext_ConnectMode ConnectMode, object AddInInst, ref Array

Write Excel Addin with VBA and then Put a button that trigger it

本秂侑毒 提交于 2019-11-26 18:22:49
问题 I have written a simple excel add-in with VBA, it contains a form and related codes. after saving it as add-in and then installing it in Excel, nothing happened! I need to put a button somewhere in ribbons that trigger my add-in, you know like "Solver". I really need it, pleas tell me how. I really appreciate any suggestions. 回答1: Try this, needs to be added to your add-in, either in a module or in ThisWorkbook. Private Const Button as String = "SomeName" Sub Auto_Open 'Or Private Sub Workboo

Exception from HRESULT: 0x800A03EC Error

て烟熏妆下的殇ゞ 提交于 2019-11-26 16:33:45
I am getting "HRESULT: 0x800A03EC" error when running Excel add-in with following code: Excel.Range rng = ActiveSheet.Cells[x, y] as Excel.Range; string before = rng.Value2; string cleanV = System.Text.RegularExpressions.Regex.Replace(before, @"\s+", ""); rng.set_Value(cleanV); When error happens X and Y are set to 1, thus Excel range is not violated. I searched extensively and tried a number of ways of setting the cell value (eg. Cells[x,y], range.set_Value()) but am at loss why this error happens and how to avoid it. Any help is greatly appreciated. Below are exception details: System

VSTO Add-ins, COMAddIns and RequestComAddInAutomationService

本小妞迷上赌 提交于 2019-11-26 14:51:17
问题 Please see 1st Edit (the screenshot at the bottom): I've followed this article to have a Winform app trigger a VSTO Add-In method: http://blogs.msdn.com/b/andreww/archive/2007/01/15/vsto-add-ins-comaddins-and-requestcomaddinautomationservice.aspx At the end of the above article the author mentions a issue and tries to ameliorate it here: http://blogs.msdn.com/b/andreww/archive/2008/08/11/why-your-comaddin-object-should-derive-from-standardolemarshalobject.aspx I have been through the code

How to get the “KeyPress” event from a Word 2010 Addin (developed in C#)?

扶醉桌前 提交于 2019-11-26 11:29:43
问题 How can I \"catch\" the KeyPress event from a Word 2010 Addin developed in C#? Note: I\'m not looking for \"complex\" solutions like hooking stuff, but for the nice and tidy .NET even from the object model. The application object I have \"in my hands\" is: Microsoft.Office.Interop.Word.Application Best Regards 回答1: Unfortunately there is nothing built-in in the Word API or VSTO which can pick up key strokes, more info on this can be found here I've been searching for a feasible solution for