Is there a way in Visual Studio to specify what a template class (new class) is going to look like? - visual-c++

I'm a long time Eclipse user trying to learn to Visual Studio. I know that Eclipse had Code Templates that would allow you to build classes with certain comments and formatting already added for a class.
For example:
Auto placing the copyright for the code at the top of the file
Who created the file
Predefined Comments,
etc...
Does Visual Studio 2005 have any functionality like this?

It depends. Visual Studio has a built-in code snippets manager that lets you do things like this to at least a degree (i.e., if you insert a code snippet, it'll be formatted as the snippet specifies, but if you write the same code manually, it won't). Also note that there are limitations on the languages with which you can use code snippets.
Outside of that, most of the major add-ins for VS (e.g., Visual Assist-X) provide their own ability to store and insert bits of code, formatted as you specify. Most of these provide at least some features missing from the built-in snippets manager such as working with other languages or being easier to access (along with quite a few other things -- IMO, VS borders on completely unusable without VA-X).

I would recommend looking at item and project templates in Visual Studio, which sound like what you're looking for. But, in your particular case (C++ development), it doesn't look like this is available to you.
The following MSDN article refers to VS templates, and mentions that for Visual C++ projects, that the template architecture isn't supported. Instead, there's information on creating custom wizards for your project and classes, which may give you the flexibility that you need. Sounds like it'll do what you want it to do, but it's much more work than it would be if you could use an item template for including basic comment structure for a default class file.
http://msdn.microsoft.com/en-us/library/6db0hwky%28VS.80%29.aspx

Related

Extend Visual Studio functionality for Installshield ISPROJ Project type

InstallShield must be the crappiest "industry standard" application in existence, for reasons too numerous to enumerate here. However, one of those deficiencies is something I'd like to be able to fix, and with my first foray into writing an extension for Visual Studio (currently using 2015 version).
InstallShield has created a .isproj type, to allow integration with Visual Studio. This allows a developer to create an installer that references the output of a project as the files to include in the installer (rather than having to manually select individual files to include). This works well enough as long as the .isproj is being built in Visual Studio, and in a solution that references the project for which you need the output.
However, I also have an automated build for my installer projects, that we run on a build server using MSBuild. When attempting to build this way, we were getting completely opaque error messages indicating that the project output references above couldn't be resolved.
As with all InstallShield errors, Googling for answers turned up nothing except for multitudes of other people having the same problem. So I decided to dig into the plain text of the .isproj to see what I could find.
As it turns out, the .isproj type is a just a regular MSBuild script, and it even has lines commented out that explain options that can be added to the project; one of those things that can be added is an ItemGroup containing ProjectReference nodes. Manually adding the nodes helped solve the problem. Command-line build now works.
However, I am dissatisfied with a) having to manually type this stuff in, b) having no visual representation of what projects are being referenced, and c) not finding out about a problem until the build fails. So, I would like to be able to extend Visual Studio to help me with this. Here's what I'd like to do:
1) Add a "References" node to the project in Solution Explorer that acts like the References node for any normal .csproj.
2) Restrict the available References to other projects in the the current solution.
3) Visually represent a project with missing references (e.g. by underlining the project name with a colored squiggly, as with errors/warnings), and potentially failing the build if missing (depending on whether I want to treat it as an error or a warning; TBD).
To these ends, I've downloaded MPF for Projects - Visual Studio 2013, which provides an SDK for creating a new project type.
However, before digging too deeply, I need to know if it's even possible to EXTEND an existing project type, as described above, as I obviously don't have InstallShield source code. Also, any links or guidance as to a starting point for doing so would be greatly appreciated.

Can I export a Visual Studio CodeMap (.DGML file) to Visio?

I'm trying to get my head around a rather large solution and I find that Visual Studio's CodeMap feature to be an invaluable aid.
However I'd like to take sections of the generated Codemap and from this, generate some pretty documentation from it. Ideally it seems sensible to me that it should be possible to import the .dgml into Visio, but instead I'm manually re-created a copy of it in Visio by hand.
Does anyone know if such a thing exists?
If not, I might set my next project as writing a DGML to VSDX converter.

How to get XML comments to appear in Visual Studio Class Wizard decriptions

I have put XML comments in a C++ source file that IntelliSense appears to pick up and use. It creates a project xml file, and IntelliSense works when I edit the original source file (showing me comments when I'm selecting a member function or entering parameters).
But, when I go to the Class Wizard in Visual Studio 2012 Express, the entered descriptions don't appear anywhere (on the methods, for example, down at the bottom of the dialog, where description remains sadly empty). For that matter, IntelliSense only works in the original file(s), so when using a call in a separate file, none of my XML comments get picked up. Why does it only work in the original source file? What have I neglected to do?
I don't think you've neglected to do anything, unfortunately.
The Class Wizard was built long before Visual Studio supported XML doc comments, so it's more likely that no one remembered/cared to go back add support for them to the Class Wizard dialog.
In my experience, although it sounds like you've had slightly better luck, XML doc comments are not particularly well supported when using C++. For example, VS 2012 was the first version to support them in IntelliSense (and even that is incomplete). You get nothing in VS 2010 and earlier versions, despite the fact that they'll happily output a project XML file. That pathetic lack of support, combined with the angle bracket tax, drove me to switch to Doxygen when writing C++ code.

How do I expand all strings in a .resx resource file in Visual Studio 2012?

VS2012's resource designer doesn't seem to have a way to "expand" long strings of text/html.
I have to double-click each and every one line to expand it.
Knowing I have about 10,000 of these to do for this localization project, I'm going to go mad if I can't find a way to go from this:
http://i.imgur.com/TiKv5.jpg
...to this: http://i.imgur.com/p41bn.jpg
If there isn't, please suggest some alternate tool, app, or method that will help me keep my sanity.
Try the Visual Studio Power Productivity Tools for some help there. I know they really enhanced it for opening and collapsing the solution folders so it might help you.
At our company we wrote a small utility to extract these resources from Visual Studio to package in the excel format that our translation company uses. It didn't take much to do that in .NET and it will certainly make your life easier in the long run.
Turns out Microsoft also has a Resource Refactoring Tool that looks like it makes it easy to pull resources out of the code and resx files into other formats. I have not tried this personally (where I have used the Productivity Tools) but it is worth looking into this option.

Making an MFC application international

I've got several large MFC applications here, and converting them into any other format is out of the question. We're expanding into other markets, and would like to make the apps work in other languages and cultures.
So far, I've found occasional references as to what to do with Visual C++ version 6, with one mention that later versions of MFC have additional relevant features. Searching MSDN gives me instructions on how to convert the apps to Unicode, which we already did. I found nothing on MSDN on how to make languages multilingual once they're in Unicode, only a few older things using Google, and one book about internationalization using VC++6. (We're using Visual Studio 2008 now, on XP and Vista.)
I make no claims for the strength of my Google-fu, and would be happy to be directed to things I've missed.
Is it reasonable to use the methods of VC++6, or should I use later features?
If I should use features later than that, where can I find some reference to them?
Is there something I should worry about other than setting the locale, converting all strings to resources, and duplicating resources in different languages?
I can find more things about .NET internationalization, but I'm inexperienced in .NET. What will I find there that's applicable to VC++ and MFC?
Edit: I just ran into difficulties trying to put Unicode strings into the String Table resource. (As far as I can tell, Unicode strings need to be entered into the .rc file with a text editor, in L"0x0034" form. I haven't found a resource editor way to do that.) Any tips on that? Any other resource I can use in VS2008 using VC++ and MFC?
Edit: Somebody on a Microsoft forum suggested that I open the offending .rc file in Notepad, and save it in Unicode. Unfortunately, this doesn't seem to fix the dialogs, although the stringtable seems to be working in Japanese.
There's a lot more than just translating "strings" to internationalize an application.
Most of your UI will need to be updated to take into account the different text lengths, and language orientation (thing Hebrew, Chinese, Arabic, ...)
Some images will also need to be changed to fit a different culture (unfortunately, I don't have an example for that), either the figurative is different or the colors do not fit local specifications.
We are using a tool like appTranslator to help us do the cosmetic localization (UI re-formatting) and use a professional technical translator for the strings.
You can also create a resource only dll
See How To Create Localized Resource DLLs for MFC Application for more details.
You can internationalize your application using the following ways.
After you converted the application to unicode (you already did) and all the strings should be loaded from String table.
For each language you need to change the string table and compile
One more way is to maintain a XML file which contains all the strings in the localized format. Load the xml and strings depending on the language.
Here's a CodeProject article of mine that describes very "coding-efficient" method to pull strings from the string table (required for translatable texts):
http://www.codeproject.com/KB/string/stringtable.aspx
Here's another class that help your app pick the right UI language. It also helps you create a language selection menu:
http://www.codeproject.com/KB/locale/LanguageMenu.aspx
Last but not least, appTranslator is a tool that helps you translate the UI of your app, detect what changes were made in resources since the last version, create translated exe or resource DLLs and much more:
http://www.apptranslator.com
(Note: I'm the author of appTranslator.)

Resources