Important alert: (current site time 7/16/2013 1:12:15 AM EDT)
 

winzip icon

[ Associate filetypes to your program ]

Email
Submitted on: 6/15/2004 2:16:02 PM
By: D. Rijmenants  
Level: Beginner
User Rating: By 7 Users
Compatibility: VB 5.0, VB 6.0
Views: 24297
author picture
(About the author)
 
     This module lets you create or delete with only a simple function filetype associations in the registry. Usefull to use your own filetypes, with theire own icon and description in your vb-project. Once you have your own filetype, this is recognized in the explorer and when you click this file, your associated program is started and the filename is passed trough to the command function in your program. The module contains lots of comments about the function and how to use the Command function. All comments, questions and suggestions are most welcome :-) ...
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 28 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
6/16/2004 11:19:15 PMPaul Turcksin

This is great stuff. Simple, very well documented and usefull.
Suggestion : make Sub MakeFileAssociation a Function that checks if extension exists and returns True/False.
5 planets from me.
(If this comment was disrespectful, please report it.)

 
6/17/2004 12:55:05 PMD. Rijmenants

Hi Paul, your comment about a function got me braining. I decided to make a separate Check-function. When you put it into MakeFileAssociation it would not only check, but also make it. By using a seperate function it only checks.I updated the zip added some more comments about the Command function. Tks for coop :-)
(If this comment was disrespectful, please report it.)

 
6/29/2004 10:57:33 PMMunkee

what if you don't a new instance of your app to load every time the file is opened, what if you want the info to go to an already running instance? how do you do that?
(If this comment was disrespectful, please report it.)

 
6/30/2004 5:29:01 AM

Good Job, Congratulations!!!
(If this comment was disrespectful, please report it.)

 
7/11/2004 3:28:31 AMRde

To Munkee - check for App.PrevInstance in Sub Main or Form_Load, if True themn pass Command to running app, then End new app.
(If this comment was disrespectful, please report it.)

 
12/4/2004 7:28:12 PMcodingmasters

Good code. keep up the good work
(If this comment was disrespectful, please report it.)

 
12/4/2004 7:45:28 PMcodingmasters

it's all well and fine setting the association, but once the file is open, how do we handle it?
(If this comment was disrespectful, please report it.)

 
1/16/2005 2:03:50 PMCaeser

"To Munkee - check for App.PrevInstance
in Sub Main or Form_Load, if True themn
pass Command to running app, then End
new app." Are there any good examples of this? I've only found a subclassing example which is very invovled and somewhat messy. is there any easier ways to handle this problem? plz email peter_daley_oz@n0Spam.yahoo.com.au
(If this comment was disrespectful, please report it.)

 
1/23/2005 12:09:52 PMJames Miller

Thank you for your submission. It's been most useful!
(If this comment was disrespectful, please report it.)

 
4/19/2005 7:51:02 AMAlpha

very nice - thank you!

(If this comment was disrespectful, please report it.)

 
2/16/2006 5:28:23 PMFlorin

If I want to open more then one file in my app without closing the previous intance, HOW CAN I DO IT ?

Let's say: Every time I want to open my files "file-1.abc" (form1.Caption =Command to be updated)

I thing the only way is to close the previous App.exe and open a new App.exe

Am I right?
(If this comment was disrespectful, please report it.)

 
8/14/2006 9:01:50 AM©¥Åñ!ð

Great Submission. Very Nice coded like all your apps. I' ve got one question. How can i set the icon of a file from e ressource-file within my exe?
(If this comment was disrespectful, please report it.)

 
10/21/2006 11:42:41 AMshehu suleiman

very great source code
(If this comment was disrespectful, please report it.)

 
12/20/2006 8:10:14 AMFERI

Sorry i can't write english very well
but i think this program is good
(If this comment was disrespectful, please report it.)

 
3/3/2007 1:52:39 PMJohn R Parrish

I think i found a bug in Sub MakeFileAssociation
Shouldn't 'If Left(PathToApplication, 1) <> "\"'
be 'If Right(PathToApplication, 1) <> "\"' ?

Also, how do you set two or more file extensions to be opened by your app?
I've tried it and both file types are now associated, but they both get set to the same icon and file description.
(If this comment was disrespectful, please report it.)

 
3/25/2009 10:22:23 PMMikael

Excellent !! And with lot of info - Great !!
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.