Welcome to Dream.In.Code
Become an Expert!

Join 136,879 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,710 people online right now. Registration is fast and FREE... Join Now!




File Associations In Visual Studio

 
Reply to this topicStart new topic

> File Associations In Visual Studio, create your own .something files

Rating  5
Rickster0
Group Icon



post 19 Jul, 2008 - 05:04 AM
Post #1


Ok i bet all of you at some time have asked yourself how do i get something like a .nxm and when i double click it my Program runs?

i will show you how to do it in 7 easy steps.

If you don't have visual studio then this won't help you.

Requirements
Visual Studio

1)Open up your solution in Visual studio.

2)Add a Setup Project to your solution by file , add project,New project, Setup & Deployment projects,Setup project

3)Right-click on your setup project in the "Solution Explorer" window,Select view,then select file types.

you'll see the "file types" window displayed in Visual studio.At the top of the window will be "File types on target machine"

4)Right-click on "File types on target machine".the menu will pop up with Add "file type" Click on this.

you'll see "New document Type#1" added,and "&open"underneath it.

5)The "new document type#1" can be anything you want - change it to something descriptive.although the user never sees this,never use something common- be as unique as possible,Because you can overlay current file associations without even realizing it.For example,you might think"pngfile" might be a useful name- but using that will now send all"*.png" files to your application,instead of to an image viewer.A good practice maybe "YourCompantName.Filetype",where your company name is your name of your company's name, and "Filetype" is a descriptive text of your file.

6)In the "properties" window for your new type,you will need to change a few properties.:

Command:Change to the application that you want to run.If you click on the "..." and you will proberly want to locate and use the "primary Output..." File
Description: This is the description of the file type(if it doesn't describe it's self"
Extensions:This your list of extensions for you chosen Program.Separate each one with a ","
Icon:This will associate the icon with your file type,This shows up in the window explorer.

7)Nearly done...
Now we move to that "&open ".This is an action that is available if your right-click on the file.The default action("&Open" is currently set as the default) is what happens when you double click on the file.Right click on your "New document type#1" to add actions,but for the moment,lets define our "&open" action

Click on "&Open".You will see in the properties window "Name","Arguments","Verbs". Verb is hidden from the user,but is the key that is stored in the registry.Leave it same as the name,But without the "&".The default for"Arguments" is "%1",Which means to pass the full path and filename to your application.You can add other stuff here as well,if you need to pass flags to your application to do special stuff.All this infomaton is getting passed to your application on the command line,so you'll need to be familiar with the "Environment.CommandLine" object.
If you need to set a different action as your default,just right click on the action and "set as default"

Hope this help everybody who's Pm me about it. biggrin.gif
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

Rickster0
Group Icon



post 20 Jul, 2008 - 12:58 AM
Post #2
I hope this helps alot of people

tongue.gif
Go to the top of the page
+Quote Post

Trickster090
*



post 20 Jul, 2008 - 01:09 AM
Post #3
Thanks i've been searching for something like this for ages
Go to the top of the page
+Quote Post

born2c0de
Group Icon



post 20 Jul, 2008 - 10:01 AM
Post #4
icon_up.gif
Nice work.
Go to the top of the page
+Quote Post

Rickster0
Group Icon



post 24 Jul, 2008 - 10:01 AM
Post #5
ty happy.gif
Go to the top of the page
+Quote Post

gbertoli3
Group Icon



post 31 Jul, 2008 - 03:26 PM
Post #6
Great Post!
Go to the top of the page
+Quote Post

Rickster0
Group Icon



post 7 Aug, 2008 - 03:40 AM
Post #7
thanks again......looks like i've done something good.... lol tongue.gif
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 12/3/08 08:25PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month