nej det er ikke det jeg mener. som f.eks. programmet word der har alle filer med efternavnet .doc fået et word icon hvordan gør man det ? på forhånd tak
Du tager en tur ind i registrerings databsen og kigger under HKEY_CLASSES_ROOT her finder du den filtype du efterlyser og ændrer tingene. Hvis du vil gøre det fra VB kan du bare bruge scripting.runtime objectet. kedde
\'// Windows Registry API calls Private Declare Function RegCloseKey Lib \"advapi32.dll\" _ (ByVal hKey As Long) As Long
Private Declare Function RegCreateKeyEx _ Lib \"advapi32.dll\" Alias \"RegCreateKeyExA\" _ (ByVal hKey As Long, _ ByVal lpSubKey As String, _ ByVal Reserved As Long, _ ByVal lpClass As String, _ ByVal dwOptions As Long, _ ByVal samDesired As Long, _ ByVal lpSecurityAttributes As Long, _ phkResult As Long, _ lpdwDisposition As Long) As Long
Private Declare Function RegOpenKeyEx _ Lib \"advapi32.dll\" Alias \"RegOpenKeyExA\" _ (ByVal hKey As Long, _ ByVal lpSubKey As String, _ ByVal ulOptions As Long, _ ByVal samDesired As Long, _ phkResult As Long) As Long
Private Declare Function RegSetValueExString _ Lib \"advapi32.dll\" Alias \"RegSetValueExA\" _ (ByVal hKey As Long, _ ByVal lpValueName As String, _ ByVal Reserved As Long, _ ByVal dwType As Long, _ ByVal lpValue As String, _ ByVal cbData As Long) As Long
Private Declare Function RegSetValueExLong _ Lib \"advapi32.dll\" Alias \"RegSetValueExA\" _ (ByVal hKey As Long, _ ByVal lpValueName As String, _ ByVal Reserved As Long, _ ByVal dwType As Long, _ lpValue As Long, _ ByVal cbData As Long) As Long
Private Sub CreateAssociation()
Dim sPath As String
\'// File Associations begin with a listing \'// of the default extension under HKEY_CLASSES_ROOT. \'// So the first step is to create that \'// root extension item CreateNewKey \".xxx\", HKEY_CLASSES_ROOT
\'// To the extension just added, add a \'// subitem where the registry will look for \'// commands relating to the .xxx extension \'// (\"MyApp.Document\"). Its type is String (REG_SZ) SetKeyValue \".xxx\", \"\", \"MyApp.Document\", REG_SZ
\'// Create the \'MyApp.Document\' item under \'// HKEY_CLASSES_ROOT. This is where you\'ll put \'// the command line to execute or other shell \'// statements necessary. CreateNewKey \"MyApp.Document\\shell\\open\\command\", HKEY_CLASSES_ROOT
\'// Set its default item to \"MyApp Document\". \'// This is what is displayed in Explorer against \'// for files with a xxx extension. Its type is \'// String (REG_SZ) SetKeyValue \"MyApp.Document\", \"\", \"MyApp Document\", REG_SZ
\'// Finally, add the path to myapp.exe \'// Remember to add %1 as the final command \'// parameter to assure the app opens the passed \'// command line item. \'// (results in \'\"c:\\LongPathname\\Myapp.exe %1\") \'// Again, its type is string. sPath = \"c:\\LongPathname\\Myapp.exe %1\" SetKeyValue \"MyApp.Document\\shell\\open\\command\", \"\", sPath, REG_SZ
\'// All done MsgBox \"The file association has been made!\"
End Sub
Private Function SetValueEx(ByVal hKey As Long, _ sValueName As String, lType As Long, _ vValue As Variant) As Long
Dim nValue As Long Dim sValue As String
Select Case lType Case REG_SZ sValue = vValue & Chr$(0) SetValueEx = RegSetValueExString(hKey, _ sValueName, 0&, lType, sValue, Len(sValue))
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.