|
Module Main
Public Sub Main()
'Running this program on its own will associate it with the .hello extension.
'Opening a .hello file after this happens will display a dialog with the contents of the
'file shown.
If (My.Application.CommandLineArgs.Count > 0) Then
Dim adjective As String = My.Computer.FileSystem.ReadAllText(My.Application.CommandLineArgs(0))
MsgBox("Hello, " & adjective & " world!")
Else
My.Computer.Registry.ClassesRoot.CreateSubKey(".hello") _
.SetValue("", "Hello", Microsoft.Win32.RegistryValueKind.String)
My.Computer.Registry.ClassesRoot.CreateSubKey("Hello\shell\open\command") _
.SetValue("", Application.ExecutablePath & " ""%l"" ", Microsoft.Win32.RegistryValueKind.String)
MsgBox("This program has been associated with the .hello extension. You may now open a .hello file from Windows Explorer.")
End If
End Sub
End Module
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.