Hi, I've recently started learning C++ and though I have been sticking to command line stuff so far, would now like to have a play with the IDEs I've downloaded, Dev-C++ and the Microsoft stuff.

When I installed Visual C++ 2005 Express edition a while back, I must have set it up so that .cpp files open up in an external editor Notepad++. I no longer want this to happen, as I want to just be able to view source in the IDE itself and be able to press a function key to compile and run as I do in Dev-C++. However, I cannot find the option to stop this happening. Can anyone help?



Re: Stopping Visual C++ IDE opening up code in an external editor? 80 80

You have to change the registry. create a command prompt then run regedit.exe.
expand HKEY_CLASSES_ROT then scroll down until you find .cpp folder. delete it as you would any other folder in windows explorer. Do the same with .c and .h. Then exit regedit.

Next open Windows Explorer and double click on any *.cpp file. This will bring up a dialog that asks you which program you want to use to run that file. I was given the option of either Dev-C++ or VC++. I chose VC++ and it was launched. Close VC++. Now every time you use Explorer and click a c++ file the os will launch VC++ without further prompting. You can do the same with *.c and *.h files if you wish.

Re: Stopping Visual C++ IDE opening up code in an external editor? 80 80

Hi Ancient Dragon

Thanks for your reply. I didn't explain my problem very well, but I've solved it now anyway, after a bit of tinkering which your reply inspired me to do!

cpp files were already set to open up in VC++ as far as the registry was concerned (I did follow your steps and delete the entry for cpp just in case though). The trouble was that VC++ was set up to open source files in Notepad++ (even if you used File>Open>File... within VC++) and I could not figure out which option in VC++ I needed to change back to the default.

While exploring VC++'s options, I found out about the file CurrentSettings.vssettings, which resides in Visual Studio 2005\Settings\C++ Express\ in the MyDocuments folder. I opened up the file in notepad and did a search for 'notepad++'. There was the culprit!...

<PropertyValue name="DefaultEditor&gt;0">cpp&gt;2&gt;notepad++.exe&gt;
NoGuid&gt;1&gt;notepad++.exe?"C:\Program Files\Notepad++\notepad++.exe"</PropertyValue>

I tried to comment this out, but wasn't sure how to do that (is the file in XML or something else, I'm not sure). Deleting the line* however did work (I had backed up the CurrentSettings.vssettings file beforehand just in case). When I started up VC++, the problem was fixed, source files no longer opened up in an external editor anymore (of course!).



* Just to see what would happen, I didn't delete or modify the line above the aforementioned line that said

<PropertyValue name= "NumberOfDefaultEditors">1</PropertyValue>

but it turned out the value was automatically changed to zero on starting up VC++ anyway.

Re: Stopping Visual C++ IDE opening up code in an external editor? 80 80

You should uninstall VC++ 2005 Express and get VC++ 2008 Express. Microsoft fixed several things that was a thorn in everyone's side with the 2005 IDE.

Re: Stopping Visual C++ IDE opening up code in an external editor? 80 80

Hi, thanks for the advice. What kinds of things did they fix?


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.