Walrus
Squire
Slovenia
34 Posts |
Posted - Oct 28 2005 : 1:46:09 PM
|
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
|
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! |
|
|
rychan
Neophyte
1 Posts |
Posted - Nov 10 2005 : 09:55:21 AM
|
Aren't there Get and SetRegistry functions available in vb6? I'm sure i saw them a while ago. |
|
|
Walrus
Squire
Slovenia
34 Posts |
Posted - Nov 10 2005 : 5:34:11 PM
|
Thanks! I'll look into it. Hopefully, I can figure it out now that I know roughly what to look for. :) |
|
|
cbx
Swordmaster
Canada
296 Posts |
Posted - Nov 11 2005 : 05:27:19 AM
|
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/ |
|
|
Walrus
Squire
Slovenia
34 Posts |
Posted - Nov 13 2005 : 09:51:44 AM
|
Great! I may have some more questions once I look into this a bit more, but for now - thank you very much! |
|
|