evo nasao sam...
nisam siguran da li radi posto nisam probao mada ne verujem da ne radi... znao sam da ima neke veze sa Registry bazom, ali ne znam tacno gde treba da se stavi... no evo kod:
'############################################
Declare Function RegCreateKey Lib "advapi32.dll" Alias _
"RegCreateKeyA" (ByVal hKey As Long, _
ByVal lpszSubKey As String, _
lphKey As Long) As Long
Declare Function RegSetValue Lib "advapi32.dll" Alias _
"RegSetValueA" (ByVal hKey As Long, _
ByVal lpszSubKey As String, _
ByVal fdwType As Long, _
ByVal lpszValue As String, _
ByVal dwLength As Long) As Long
' Return codes from Registration functions.
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 = 256&
Public Const REG_SZ = 1
'*----------------------------------------------------------*
'* Name : CreateAssociation *
'*----------------------------------------------------------*
'* Purpose : Associate a file type with a program in *
'* : Win95 and WinNT *
'*----------------------------------------------------------*
'* Parameters : strAppKey Required. File type alias. *
'* : strAppName Required. File type name. *
'* : strExt Required. File type extension. *
'* : strCommand Required. Command associated *
'* : with file type. *
'*----------------------------------------------------------*
Private Sub CreateAssociation(strAppKey As String, _
strAppName As String, _
strExt As String, _
strCommand As String)
Dim sKeyName As String ' Holds Key Name in registry.
Dim sKeyValue As String ' Holds Key Value in registry.
Dim ret As Long ' Holds error status if any from
' API calls.
Dim lphKey As Long ' Holds created key handle from
' RegCreateKey.
'Creates a Root entry called strKeyName.
sKeyName = strAppKey
sKeyValue = strAppName
ret = RegCreateKey(HKEY_CLASSES_ROOT, sKeyName, lphKey)
ret = RegSetValue(lphKey&, "", REG_SZ, sKeyValue, 0&)
'Creates a Root entry called strExt associated with strKeyName.
sKeyName = strExt
sKeyValue = strAppKey
ret = RegCreateKey(HKEY_CLASSES_ROOT, sKeyName, lphKey)
ret = RegSetValue(lphKey&, "", REG_SZ, sKeyValue, 0&)
'Sets the command line for strKeyName.
sKeyName = strAppKey
sKeyValue = strCommand
ret = RegCreateKey(HKEY_CLASSES_ROOT, sKeyName, lphKey)
ret = RegSetValue(lphKey&, "shell\open\command", REG_SZ, _
sKeyValue, MAX_PATH)
End Sub
ovo sve stavi u jedan fajl i kada pozivas uradi ovako...
Sub test_Association()
CreateAssociation "TestApp", "App for Assoc testing", ".pcd", _
"notepad.exe %1"
End Sub
znaces sta je sta posto pise i iznad procedure sta je... tako da je to to... javi da li radi...
sorry sto nisam bojio, ali me je mrzelo
pozdrav!
|