For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > February 2006 > Make Visual C++ recognize file extensions as C++ files









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Make Visual C++ recognize file extensions as C++ files
Mike

2006-02-20, 3:56 am

Hi all,

I'm trying to make VS2005 recognize other file extensions i.e. *.y as
C++ files. This way I can use the color coding and auto indentions, etc
of the VS tect editor for projects that are actually for other tools. I
know I can just append the file names with .cpp, but I'm changing the
files and uploading them to a remote server to compile them often, so it
gets to be a pain renaming them all the time.

I found an MS KBB article on how to do it for older versions of VS at
the link below, but VS2005 doesn't use all of the same registry keys,
and changing the ones that do match the article doesn't work. Anyone get
this to work in VS2005 or have suggestions?

http://support.microsoft.com/kb/q181506/

-Thanks,
Mike


Mike

2006-02-20, 3:56 am

So, I figured this out and thought I'd post the answer here in case
someone else needs to do it.

Navigate to the following registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Vi
sualStudio\8.0\Languages\File
Extensions\

There you will see subkeys for all the familiar source code file types.
Add one for the extension you want to be recognized as C++ (or other)
code and enter the following for its "(Default)" value

{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}

If you want a file to use some other editor's features like C# or VB,
just find the key in this section for an extension that already uses
that editor, then follow the steps above, but substitute the value from
the key you just looked up for the on I provided.

Setting the file file to be opened in VS when double clicked can be done
by right clicking it, choosing properties and modifying the "open with"
value but I'm sure everyone here already knows how to do that.

-Mike



Mike wrote:

> Hi all,
>
> I'm trying to make VS2005 recognize other file extensions i.e. *.y as
> C++ files. This way I can use the color coding and auto indentions,
> etc of the VS tect editor for projects that are actually for other
> tools. I know I can just append the file names with .cpp, but I'm
> changing the files and uploading them to a remote server to compile
> them often, so it gets to be a pain renaming them all the time.
>
> I found an MS KBB article on how to do it for older versions of VS at
> the link below, but VS2005 doesn't use all of the same registry keys,
> and changing the ones that do match the article doesn't work. Anyone
> get this to work in VS2005 or have suggestions?
>
> http://support.microsoft.com/kb/q181506/
>
> -Thanks,
> Mike
>


Mike

2006-02-20, 3:56 am

So, I figured this out and thought I'd post the answer here in case
someone else needs to do it.

Navigate to the following registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Vi
sualStudio\8.0\Languages\File
Extensions\

There you will see subkeys for all the familiar source code file types.
Add one for the extension you want to be recognized as C++ (or other)
code and enter the following for its "(Default)" value

{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}

If you want a file to use some other editor's features like C# or VB,
just find the key in this section for an extension that already uses
that editor, then follow the steps above, but substitute the value from
the key you just looked up for the on I provided.

Setting the file to be opened in VS when double clicked can be done
by right clicking it, choosing properties and modifying the "open with"
value but I'm sure everyone here already knows how to do that.

-Mike



Mike wrote:

> Hi all,
>
> I'm trying to make VS2005 recognize other file extensions i.e. *.y as
> C++ files. This way I can use the color coding and auto indentions,
> etc of the VS tect editor for projects that are actually for other
> tools. I know I can just append the file names with .cpp, but I'm
> changing the files and uploading them to a remote server to compile
> them often, so it gets to be a pain renaming them all the time.
>
> I found an MS KBB article on how to do it for older versions of VS at
> the link below, but VS2005 doesn't use all of the same registry keys,
> and changing the ones that do match the article doesn't work. Anyone
> get this to work in VS2005 or have suggestions?
>
> http://support.microsoft.com/kb/q181506/
>
> -Thanks,
> Mike
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com