How to set up program with set as default editor option

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
User avatar
0mfc0





Posts: 218
Joined: Sun May 07, 2006 11:10 am
Location: Indiana

How to set up program with set as default editor option

Post 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
Image
Patrickssj6




Pi Collaborator

Posts: 5426
Joined: Sat Jul 24, 2004 12:12 pm
Location: I'm a Paranoid
Contact:

Post by Patrickssj6 »

THANK you thats so awesome :D
...left for good
PlasmaGhost





Posts: 149
Joined: Wed Oct 05, 2005 12:23 pm

Post by PlasmaGhost »

thats what i did with HMHC but in C#
User avatar
0mfc0





Posts: 218
Joined: Sun May 07, 2006 11:10 am
Location: Indiana

Post by 0mfc0 »

yes a lot of people probably do it this way. I am unaware of any other way to do it
Image
Post Reply