Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 A question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Walrus
Squire

Slovenia
34 Posts

Posted - Oct 28 2005 :  1:46:09 PM  Show Profile  Reply with Quote
First of all, I have to confess that I haven't really searched for the answer extensively, so if the solution is already available somewhere, let alone on this forum, or if it happens to be very obvious, I apologize.

That said, here the thing: say you make a program that uses its own file format, like savegames for a game or sth. Then, you'd like to make your program the default program for opening this kind of files. Now, the user could do this sort of thing on his/her own, of course, but you'd like to automate it, during installation or the first time the program is executed, like many programs do. How would you go about doing that in VB(6.0)?

Any help greatly appreciated.

TwistedMatrix
Neophyte

3 Posts

Posted - Nov 09 2005 :  12:25:49 PM  Show Profile  Visit TwistedMatrix's Homepage  Send TwistedMatrix a Yahoo! Message  Reply with Quote
Its a registry thing. You need to create a new registry entry for the extention type. Sorry, dont have a code example. If you figure it out let me know.


We who are about to die, salute you!
Go to Top of Page

rychan
Neophyte

1 Posts

Posted - Nov 10 2005 :  09:55:21 AM  Show Profile  Visit rychan's Homepage  Reply with Quote
Aren't there Get and SetRegistry functions available in vb6? I'm sure i saw them a while ago.
Go to Top of Page

Walrus
Squire

Slovenia
34 Posts

Posted - Nov 10 2005 :  5:34:11 PM  Show Profile  Reply with Quote
Thanks! I'll look into it. Hopefully, I can figure it out now that I know roughly what to look for. :)
Go to Top of Page

cbx
Swordmaster

Canada
296 Posts

Posted - Nov 11 2005 :  05:27:19 AM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
VB6 has the GetSetting and SetSetting but they only provide restricted access to the registry You will need to use the win32 api calls or use managed .net code to access the complete registry including the parts that are involved in file type association.

To associate a file extention with your app falolow these steps


  • Click "Start" then "Run" and run "regedit"

  • Right click "HKEY_CLASSES_ROOT" and create a "new->key" with your file extention If your file extention is "testext" then name the key ".testext" making sure to include the period before the extention

  • With your new key selected in the left side tree Right click the "(Default)" item in the right pane and select "Modify"

  • Give the "(Default)" item a unuiqe key something similar to your apps name like "testextapp"

  • Right click "HKEY_CLASSES_ROOT" again and create a "new->key" with the name you specified in the previous step for example "testextapp"

  • Right click the "testextapp" key and add a "New->Key" and call it "Shell"

  • Right click the "Shell" key and add a "New->Key" and call it "Open"

  • Right click the "Open" key and add a "New->Key" and call it "Command"

  • With the "Command" key selected right click the "(Default)" item in the right pane and select "Modify"

  • type the full path to your app and include a %1 at the end. For example "c:\windows\notepad.exe %1"



Now all files ending in ".textext" will be associated with notepad. Double clicking a .textext file will run notepad and notepad will open the file.

Created by: X
http://www.createdbyx.com/
Go to Top of Page

Walrus
Squire

Slovenia
34 Posts

Posted - Nov 13 2005 :  09:51:44 AM  Show Profile  Reply with Quote
Great! I may have some more questions once I look into this a bit more, but for now - thank you very much!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.11 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.