I am writing a little code to associate an extention with
my program. And as far as i can see, i need to do the
following:
Public Function associatefile(B yVal
FILE_EXTENTION_ TO_ASSOCIATE As String, ByVal
FILE_EXTENTION_ DESCRIPTION As String, ByVal EXE_NAME As
String, ByVal DEFAULT_OPEN_CO MMAND As String, ByVal
DEFAULT_ICON As String, ByVal ACTION_NAME As String)
Dim RegKey As RegistryKey
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\")
RegKey.SetValue ("", FILE_EXTENTION_ DESCRIPTION)
RegKey.SetValue ("EditFlags" , 0)
RegKey.SetValue ("AlwaysShowExt ", "")
RegKey.SetValue ("BrowserFlags" , 8)
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\DefaultIcon\ ")
RegKey.SetValue ("", DEFAULT_ICON)
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\shell\")
RegKey.SetValue ("", ACTION_NAME)
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\shell\" & ACTION_NAME & "\command\" )
RegKey.SetValue ("", DEFAULT_OPEN_CO MMAND)
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\shell\" & ACTION_NAME
& "\ddeexec\Appli cation\")
RegKey.SetValue ("", ACTION_NAME)
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\shell\" & ACTION_NAME
& "\ddeexec\Topic \")
RegKey.SetValue ("", "system")
RegKey = Registry.Classe sRoot.CreateSub Key
("Applications\ " & EXE_NAME & "\shell\open\co mmand\")
RegKey.SetValue ("", DEFAULT_OPEN_CO MMAND)
RegKey = Registry.Classe sRoot.CreateSub Key
(FILE_EXTENTION _TO_ASSOCIATE)
RegKey.SetValue ("", "CMG.ASSOCIATIO N")
End Function
Example how to call it:
CMG.associatefi le(".CMGCHECK" , "CMG CHECKING
FILE", "CMGCHECK.E XE", """C:\CMGCHECK. EXE"" ""%
1""", "shell32.dll,44 ", "CHECK CMG DATABASE")
the values 0 and 8 should be dwords, but i just dnno how
to add it as dword... i searched on google and MSDN
without luck. The Object browser also has no data for
DWORD.
Thanx in advance.
N.B.
If the things i do above are not correct, plz tell me
what i am missing...