Page 1 of 1

How to set up program with set as default editor option

Posted: Sat May 20, 2006 5:15 pm
by 0mfc0
Ok I am going to show you how to make a program have a set as default editor button (I am using pics from the app i am working on now)

First: Make a button on menustrip or where ever you want it. Then name it set as default editor
Image

Second: View the code of the form and at the very top put

Code: Select all

Imports Microsoft.Win32
Then double click the set as default editor button you made, Put this code in it

Code: Select all

If MsgBox("Are you sure you want to set 'name of project here' as the default map editor?", MsgBoxStyle.YesNo, "Set As Default Map Editor?") = MsgBoxResult.Yes Then
            Dim regKey As RegistryKey
            regKey = Registry.ClassesRoot.CreateSubKey("'name of project here'\")
            regKey.SetValue("", "Halo 2 Map File")
            regKey = Registry.ClassesRoot.CreateSubKey("'name of project here'\shell\open\command")
            regKey.SetValue("", Application.ExecutablePath & " %1")
            regKey = Registry.ClassesRoot.CreateSubKey("'name of project here'\DefaultIcon")
            regKey.SetValue("", Application.ExecutablePath & ",0")
            regKey = Registry.ClassesRoot.CreateSubKey(".map")
            regKey.SetValue("", "'name of project here'")
            regKey.Close()
            MsgBox("Done.", MsgBoxStyle.Information, "Registry Information:")
        End If
Just fill in the places with 'name of project here' with your project name.

Now the halo 2 map icons will be the icon of your app, and when you double click the maps it should open up your app

here are what my map files look like, it has the icon of my project
Image

Hope this helps someone. :)

EDIT: this is in vb 2005 EE

Posted: Sun May 21, 2006 4:13 am
by Patrickssj6
THANK you thats so awesome :D

Posted: Sun May 21, 2006 11:09 am
by PlasmaGhost
thats what i did with HMHC but in C#

Posted: Sun May 21, 2006 2:13 pm
by 0mfc0
yes a lot of people probably do it this way. I am unaware of any other way to do it