Click here to Skip to main content
15,880,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Is there a way to access visual studio 2010 and 2012 query results pane from Addin?

I am not referring to query window from Menu - Data - Transact SQL Editor - new query. I am thinking from Server explore - expand some database - expand tables, right click on table and choose new query. After you select what tables will be included, check couple of columns and choose execute. New window will open. That window is Document class I know, but not able to get contents of controls or pane's or even panels from that class. At the bottom you can see a pane with rows and columns.

I need to access that pane or grid control if it's possible. Or even better somehow over reflection to retrieve a cell value of a selected cell in that query results window?

I already built addin for VS, but having trouble to retrieve cell's value from that grid. Tried with reflection but cannot get to the bottom of the problem which or even where this pane or grid control is.

And this is for VS 2012. How can I extract control or wpf I am not sure what is, from active document in VS 2012 since it's returning WindowBase type? Not sure what type of control that is, since it's showing me from spy++ windows.8.app. So I need that control when you open sql query editor from SQL - T-SQL - new query. Essentially I need results tab and accessing cell value when results from query are displayed in grid. Is it possible to retrieve some of those values? And by this I am referring to the control or wpf that I mentioned and also those cell values. The reason I am asking this is because in VS 2010 you can pool control from window handle of that active window like this:

Control.FromHandle(FindScriptEditorHandle(scriptWindowHandle));

C#
private static IntPtr FindScriptEditorHandle(IntPtr scriptWindowHandle)
        {
            return NativeMethods.FindWindowEx(scriptWindowHandle, IntPtr.Zero, null, null);
        }


But in VS 2012 I get null for a return value of control. I know that is not a control, but don't know what is it.

I was able to get IWindowFrame, since that frame is having these interfaces IOleDocument, IOleDocumentView, IEnumOleDocumentViews; I wasn't able to obtain IVsCodeWindow.

Thanks
Posted
Updated 29-May-13 7:45am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900