Anyone using Visual Assist? How does VA get the source code content? - visual-c++-6

I'm using Visual Assist with VC6, it seems to be a powerfull tool.
As a programmer, I'm curious about the implementation. I'm wondering how does VA get the source code content? it seems that VA knows every line of my code file, even when it's modified and not saved into file.
I've looked into addin dev for a while, VC6's addin interface doesn't provide such kind of interface to get current code content, especially when source file is modified and not saved.
I guess VA uses some tricks to do so, but what' it? Subclass?

surely VA is implemented as a visual studio add-on, which i guess would have access to some sort of visual studio API which i suppose would expose stuff like code editor content etc.
see this link for more info: http://www.microsoft.com/downloads/details.aspx?FamilyId=59EC6EC3-4273-48A3-BA25-DC925A45584D&displaylang=en
hth

I guess they use some kind of "hook" tech to monitor the change of source content. e.g. SetWindowLong/SetWindowsHookEx

Related

Visual Studio extensions for code generation...what's the best way

So we have this tool, it's a web page, we drop a large piece of text in textBox a (say sql) run the tool
and it generates the guts of a code file in TextBoxb (say a custom view class model).
it's written in C#.
I know there are several ways to create visual studio extensions.
What I'd like to know is, what's the best/easiest/fastest way to take a c# dll that has a method that takes text in and returns text out, and turn it into a VisualStudio extenson, that takes text in and creates a files, adds it to the project and puts the text into it.
We're using Vs2008 and VS2010, and I'm okay the best soloution only work on 2010.
The closest I've found by googling so far is this:
http://visualstudiomagazine.com/articles/2009/03/01/generate-code-from-custom-file-formats.aspx
but they are for custom file formats only, i want to generate*.cs and *.rdlc and similar files.
I'd also like to be able to add methods to an existing class.
tutorial walkthroughs or better approaches woud be greatly appreicated.
VS package Builder is the answer. Lots easier.

autoexp.dat does not seem to take affect in Visual Studio C++ 2005 debugger

autoexp.dat does not seem to take affect in Visual Studio C++ 2005 debugger.
I am not trying to add any custom rules. Just want commonly used stuff like stl::string, to display in a friendlier manner.
Does anyone know. how I can accomplish this? Is this just question of specifying a path to the autoexp.dat file somewhere. The file is available under the Visual Studio installation directory.
I had a similar problem in 2008, with the debugger showing only the e.g. std::vector _Myfirst,
_Mylast members rather than the vector size and children.
Open Tools/Options/Debugging/General and clear the flag "Show raw structure of objects in variable windows"
(Presumably the suggest
This got me the closest.
http://garrys-brain.blogspot.com/2007/12/stlport-visual-studio-2005-visualisers.html
It would appear you need to make adjustments for types while using ports.
Also you might have to make changes to the display to display exactly what you want.
I think this may have to do with the infamous VirtualStore in Windows Vista/7. I could change this in XP but when I try to update the autoexp.dat file in Win7 it creates a copy in AppData\Local\VirtualStore.... instead. I assume that the studio does read the original file when starting, so my changes are not seen. If anyone knows how to be able to edit the actual file please tell me how!

.NET Solution Viewer

Does anyone know of a program which works like a Adobe PDF Reader except for .NET solutions?
I develop in a virtual machine but there are times when I just want to open a solution and browse the files. I have no intention of doing any development, I just want to view them.
Does this app exist, or is Notepad++ my best option?
Thanks!
You might want to consider making a simple XSL Transform that can read the SLN and create pretty little list of files for you.. if that's what you mean, otherwise the XML is probably the best you are going to get.
Never heard of a "solution reader." When viewing source files on a system without VS.NET I use Notepad.

Tool to view the contents of the Solution User Options file (.suo)

Are there any free tools available to view the contents of the solution user options file (the .suo file that accompanies solution files)?
I know it's basically formatted as a file system within the file, but I'd like to be able to view the contents so that I can figure out which aspects of my solution and customizations are causing it grow very large over time.
A bit late for the original poster, but maybe useful to others.
Two freeware viewers for structured storage files (including .suo-files):
https://github.com/ironfede/openmcdf (old URL: http://sourceforge.net/projects/openmcdf/)
http://www.mitec.cz/ssv.html (free for non-commercial use)
When you open a .suo file in one of these viewers, you will see streams related to:
Bookmarks
Debugger watches
Unloaded projects
Outlining
Task-list user tasks
Debugger exceptions
Debugger Breakpoints
Debugger find source data
Open document windows
And much more...
The .SUO file is effectively disposable. If it's getting too large, just delete it. Visual Studio will create a fresh one.
If you do want to go poking around in it, it looks like an OLE Compound Document File. You should be able to use the StgOpenStorage function to get hold of an IStorage pointer.
I'm not aware of a tool, but you could write a Visual Studio extension to list the contents without too much work.
If you download the Visual Studio SDK, it has some straightforward examples that you can use. Find one that looks appropriate (like maybe the Toolwindow, if you want to give yourself a graphical display) and lift it (for your own personal use, of course).
What makes it easy is that the Package class which you implement in any VS extension, already implements the IVSPersistSolutionOpts, as aku mentioned. So you can just call the ReadUserOptions method on your package and inspect the contents.
I don't know any tool, but you can try to access user settings via IVsPersistSolutionOpts interface
You can use the built in tool that comes with OpenMCDF, which is called Structured Storage Explorer. It doesn't allow you to see all the details, but allows you to see all the individual settings and their sizes. In order to see the actual settings, you need to format the bytes as UTF-16.
Reference:
https://github.com/ParticularLabs/SetStartupProjects
I created an open source dotnet global tool for this:
dotnet install --global suo
suo view <path-to-suo-file>
More information at https://github.com/drewnoakes/suo

Scripting the Visual Studio IDE

I'd like to create a script that will configure the Visual Studio IDE the way I like it. Nothing vastly complicated, just a few Tools/Options settings, adding some External Tools, that kind of thing.
I know that this can be done inside VS with Import/Export Settings, but I'd like to be able to automate it from outside of VS. Is this possible, and if so, how?
Edited to add: doing it from outside of VS is important to me -- I'm hoping to use this as part of a more general "configure this newly-Ghosted PC just the way I like it" script.
Edited again: the solution seems to be to hack CurrentSettings.vssettings, or use AutoIt. Details below.
Answering my own question, in two ways:
In VS2005/8, the things I mentioned (Tools/Options, External Tools) are all stored in the CurrentSettings.vssettings file, in the folder "Visual Studio 200{5|8}\Settings". This file is just XML, and it can be edited programmatically by anything that knows how to parse XML. You can also just paste a new vssettings file over the top of the default one (at least, this works for me).
The larger question of configuring a virgin PC. It turns out that not everything I want to change has an API, so I need some way of pretending to be a user who is actually sitting there clicking on things. The best approach to this seems to be AutoIt, whose scripting language I will now have to learn in my Copious Free Time.
An easy way is to use the macro recorder to do something simple, then look at the code it produces and edit it as you see fit.
On my machine Visual Studio stores it's local settings in a file called VCComponents.dat. Its a text file, so perhaps you could find a way of placing your settings directly in there.
The file is stored in my users local AppData\Local\Microsoft\VC folder

Resources