views:

2171

answers:

14

Some of us would invariably have to support 'legacy' code using Microsoft's Visual Studio 6.0 IDEs which - although opinions would differ - are generally regarded to be less user friendly compared to the later incarnations of the Visual Studio series of IDEs.

So I'd like to hear about some of your favourite hidden/poorly documented IDE features (could be for either C++ or VB). As is the usual practice one feature per post, please.

+5  A: 

I'll kick this off a VS C++ feature which has saved me lots of time: appending a ",su" (without the quotes) to a unicode string in the watch window of a debugger enables you to view the value of the string (rather than the memory address of that string)

jpoh
Man, you are a life-savior!
tomash
+1  A: 

Shift-Alt-Enter to increase the size of the editor window

Airsource Ltd
+6  A: 

The Erl function in VB6. If you put line numbers in your VB6 code, you can, in your error handler, access the line number at which your error occurred via the return value of the function Erl.

raven
You can put the line numbers and/or error handlers in automatically with a free tool like MZTools. http://www.mztools.com/v3/mztools3.aspx
MarkJ
+4  A: 

For VC6, get a copy of Visual Assist X by Whole Tomato. It contains a smart (and usable) Intellisense replacement, much richer code coloring, some refactoring support, and many more features. Most definitely worth the investment.

Matt Dillard
+10  A: 

For VB6, MZ-Tools is a fantastic free add-in. My favorite features are its find feature and its ability to find all callers of a given routine with a click of the button. It has several other features as well, several of which I've found helpful on occasion.

Matt Dillard
Great tip! Made my life much easier on commenting and looking at unmaintainable function.
Manuel Ferreria
MZ-Tools has saved me a ton of time. Spend some time configuring it. You won't regret it.
Matthew Cole
+6  A: 

Custom Code Templates in VB6

I don't know if this is really a "hidden" feature or not, but always thought it was a nice time-saver.

You can create your own custom templates for classes, modules, forms, etc. and make them available in the IDE. For example, I usually like to use strongly-typed Collection classes in my VB6 code. So I might want a FooCollection that holds Foo objects and nothing else, instead of a plain old Collection. I don't want to have to reimplement the Collection interface every time I need a new strongly-typed Collection, so I created a new class template that contained all the boiler-plate Collection code. Now whenever I go to add a new class module to my project, my custom TypedCollection template is available as an option. Then I just rename the newly-added class FooCollection and replace all occurences of "As Object" with "As Foo" (where Foo is the type of object I want to store in the collection) and I'm done.

Keeping with my custom class template example, here's what you do:

  1. Open up the IDE and start a new project (I usually just do Standard EXE, because it doesn't really matter what you pick here).
  2. Add a new class to the project. This will become your template.
  3. Code your template class. Basically just write any boiler-plate code that you would like to be able to reuse in other projects. This is straight VB code, nothing special.
  4. When you're finished save your file in your C:\Program Files\Microsoft Visual Studio\VB6\Template\Classes folder (Note: the other subfolders, such as Forms, etc. are for other kinds of templates). The name of the .cls file minus the extension is what will appear in the IDE, so I normally include spaces in the file name for readability.
  5. The next time you open up your IDE and click Project->Add Class Module, your template class will appear in the list of available class templates.
Mike Spross
+3  A: 

CodeShine: VB6 code refactoring add-in (free). Includes refactorings such as Extract Method, Introduce Explaining Variable, Extract Function, Introduce Explaining Variable, Rename, etc

http://www.wsdesigns.com/CodeShine/default.htm

sharvell
Looks interesting, and may well be worth purchasing, but it's not free - it costs $75.
Matt Dillard
A: 

Quick macros was always a personal favorite of mine; not really a hidden feature per-se, but very useful, and VC6 was the last version where they were quick enough to be useful (before MS rewrote the macro engine to use .NET).

Nick
Could you describe how it works?
jpoh
+3  A: 

There are quite a few tips and tricks here. My favorite one is placing @err,hr in the Watch window to get error messages.

Nemanja Trifunovic
+3  A: 

You can edit the file C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\AUTOEXP.DAT to add rules for displaying meaningful values of your custom classes in the Debug Watch Window.

What I mean is this. We have a date structure defined like this:

typedef struct tagMHDATE
   {
   short int  nDay;      // Day of the Month  1..31
   short int  nMonth;    // Month of the Year 1..12
   short int  nYear;     // Year
   } MHDATE, FAR *LPMHDATE;

If I have this code:

MHDATE today;
GetDate(&today);

...and drop today in the watch window, I'll see something like this:

today    {...}

Now go and add this to the end of AUTOEXP.DAT (it's just a text file)

tagMHDATE=date=<nMonth>/<nDay>/<nYear>

...and now I see this in the Watch window:

today    {date=10/8/2008}
John Dibling
A: 

My answer to the question "If you are not satisfied with answers on someone else’s question, should you start your own?" shows how to pre-populate VC++ with all your source paths. It's useful for those of us who build from the command line, but debug using msdev.

Jason Etheridge
Don't you mean your answer to the question "Pre-setting locations for looking for source files in Visual C++ 6.0" at http://stackoverflow.com/questions/154661/pre-setting-locations-for-looking-for-source-files-in-visual-c-60#173240 ?
Troy Howard
+12  A: 

Last time I had to use VB6, I wanted to jump out of my skin in anger because the scroll wheel on my mouse, which literally works with every other program in Windows, didn't work. This has something to do with the age of VB6 and how Microsoft has changed scroll wheel functionality over the years.

This guy wrote a program to make it work.

(and it looks like in the years since Microsoft made a fix as well)

Schnapple
It's also about mouse drivers. I've got proper ones, and have never had the scrolling problem in VB6 (and have always advised people to install proper drivers for their mice).But in VBA, there was a problem indeed, and Microsoft fixed it in Office 2003 SP3.
GSerg
Oh god, I've been developing in vb6 for the past 10 months, and not once could I find the scroll wheel fix. Just when I finished the project, I happen to stumble upon your answer. If I could upmod you 20 times, I would.
Manuel Ferreria
Yay, my terrible website made it into a Stack Overflow answer! And, it took me 1.5 years to notice.
Joe
+4  A: 

Change the "Start in" property on the shortcut that you use to start VB6 to the root of your source code directory. This will save many wasted mouse clicks every time you open a project from within the IDE.

JeffK
A: 

Not really a VB6 IDE feature, but if you have to fill an unbound listview with a lot of data then making it invisible during the filling process speeds it up by maybe a factor of 10.

Tony
how do you make a listview invisible?
jpoh
Just:listview.visible = falsethen iterate through your recordset populating the listview manuallythen listview.visible = true once complete.Only really applies if you use a listview unbound, which I tend to.
Tony