yeni bir projeye yeni bir module ekle, bu modulun icine bunlari koy
'-------------------------------MODULE-----------------------------
Declare Function RegCreateKey Lib "advapi32.dll" Alias _
"RegCreateKeyA" (ByVal hKey As Long, _
ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegSetValue Lib "advapi32.dll" Alias _
"RegSetValueA" (ByVal hKey As Long, _
ByVal lpSubKey As String, ByVal dwType As Long, _
ByVal lpData As String, ByVal cbData As Long) As Long
Public Const ERROR_SUCCESS = 0&
Public Const ERROR_BADDB = 1&
Public Const ERROR_BADKEY = 2&
Public Const ERROR_CANTOPEN = 3&
Public Const ERROR_CANTREAD = 4&
Public Const ERROR_CANTWRITE = 5&
Public Const ERROR_OUTOFMEMORY = 6&
Public Const ERROR_INVALID_PARAMETER = 7&
Public Const ERROR_ACCESS_DENIED = 8&
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const MAX_PATH = 260&
Public Const REG_SZ = 1
'-------------------------------------------------------------------
Form`a bir button koy, ve formun koduna da sunu ekle
'--------------FORM---------------------------
Private Sub Command1_Click()
Dim sKeyName As String 'Holds Key Name in registry.
Dim sKeyValue As String 'Holds Key Value in registry.
Dim ret& 'Holds error status if any from API calls.
Dim lphKey& 'Holds created key handle from RegCreateKey.
' "MyApp" adinda root entry yarat.
sKeyName = "MyApp"
sKeyValue = "My Application"
ret& = RegCreateKey&(HKEY_CLASSES_ROOT, sKeyName, lphKey&)
ret& = RegSetValue&(lphKey&, "", REG_SZ, sKeyValue, 0&)
' sKeyName'i istegidin extensiona ayarla
sKeyName = ".XXX"
' asagidaki butun "MyApp"lari senin programin ismiyle degis
sKeyValue = "MyApp"
ret& = RegCreateKey&(HKEY_CLASSES_ROOT, sKeyName, lphKey&)
ret& = RegSetValue&(lphKey&, "", REG_SZ, sKeyValue, 0&)
' "MyApp" icin command line'i ayarla
sKeyName = "MyApp"
'asagidaki c:\mydir\my.exe'yi dosyayi calistirmasini istedigin programla degis
sKeyValue = "c:\mydir\my.exe %1"
ret& = RegCreateKey&(HKEY_CLASSES_ROOT, sKeyName, lphKey&)
ret& = RegSetValue&(lphKey&, "shell\open\command", REG_SZ, _
sKeyValue, MAX_PATH)
'-----------------------------------------------------
hepsi bu formun ustundeki buttona basinca .xxx uzantisi belirttigin programla calismasi gerek.