Visual C++ Form Designer is replacing all my "new" with "gcnew" - visual-c++

I have inherited a Visual C++ project with about four thousand lines of code in a single file. The code compiles great with /clr:oldSyntax but when I change anything in the designer, it updates it to the new syntax and then everything breaks.
How do I keep the designer from converting my code to the new syntax (gcnew et al)? If this isn't possible, what's the quickest way to convert the entire project at once to the new syntax?

Unfortunately, this is not possible. The Windows Forms designer stopped supporting the old managed C++ syntax back in version 2003. You'll have to either revert back to that version of Visual Studio for maintenance of this code base, or bite the bullet and convert the project to use the new C++/CLI syntax.
I don't know if you're going to find much in the way of an automated solution for converting from managed C++ to C++/CLI. You might start looking in the answers to this question.
In my personal experience/opinion, the designer is more trouble than it's worth when working in C++/CLI. I would strongly consider making the necessary modifications to your form classes by hand and not letting the designer bungle your code in the first place. "If it ain't broke, don't fix it."

Related

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.

Dreamweaver vs aptana studio (for those who don't know coding)?

I am a web designer and developer but I don't know any scripting language. And I am looking for a robust web development WYSIWYG like software that can write code for me automatically in javascript and php.
Id go with dreamweaver because is has the design view as well as the code view. Aptana is more for developers rather than designers and developers. Dreamweaver will write some code for you (and you'll find out later that its crap!) so it'll get you used to the languages.
I used to work in Dreamweaver when I first started but now I can't get enough of Aptana.
WYSIWYG will only generate HTML page and a little JS at best. You need to know coding to offer interactive functionality.
You'll hate this answer but take some time to learn PHP and JavaScript - I stated off as a designer and tried to avoid code. Then instead of copying and pasting code hoping that it works I got to grips with the fundamentals of both languages and realised how easy it is and how there was nothing to fear.
Good resources are w3schools.com, stackoverflow (obviously) and my fav JavaScript books are DOM scripting by Jeremy Keith and Jeffrey Sambells and once you feel confident to learn some of the more advanced features of JavaScript, JavaScript Patterns by Stoyan Stefanov was helpful to me.
Like I say this doesn't actually answer your question. However Dreamweaver automatically produced a 700 line JS file for an interface action I wanted, using the resources above I did the same in an unobtrusive manner with 16 lines of code!
I realize this is an old thread but im sure the debate still rages on LOL... i've been a devote DW user for many many many years (Like since 2000 or so). I am a coder/developer... I never use DW auto complete or anything like that. Primarily the reason i've stuck with it is because my FTP is RIGHT THERE!... HOWEVER, LOL, I just ran into a problem where I needed to recover a file (all these years and i've never needed this feature). Anyway I just ran across this thread Recover Deleted Files in Aptana Studio 3? "By default Aptana Studio stores a history of up to 7 days if the file was within a project."... I guess i can live without having my ftp right there in the same program and just use filezilla. sigh lol. Also DW doesnt recognize keys which is a big let down but yea... anyway... I just started using Aptana Studio 3 so I hope I fall in love with it quickly lol I'm building my projects now :P
Well, just to clarify some stuff. Aptana does have ftp, and i even think it's easier to use than dreamweaver's ftp module...

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

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

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