Jeg har prøvet et lave en Shell Icon Handler, men der virker bare ikke.
Registry keys
HKEY_CLASSES_ROOT\.hello\(Default) = "HelloFile"
HKEY_CLASSES_ROOT\HelloFile\(Default) = "Hello"
HKEY_CLASSES_ROOT\HelloFile\DefaultIcon\(Default) = "%1"
HKEY_CLASSES_ROOT\HelloFile\shellex\IconHandler\(Default) = "{8b91aaad-9cb6-3f98-9aef-bbf26067c7f4}"
HKEY_CLASSES_ROOT\CLSID\{8b91aaad-9cb6-3f98-9aef-bbf26067c7f4}\InprocServer32\(Default) = "C:\Users\PERSONALE\Desktop\ClassLibrary1.dll"
Kode:
Imports System.Runtime.InteropServices.ComTypes
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Drawing
<ComVisible(True)> _
Public Class Handler
Implements IPersistFile, IExtractIcon
Dim FilePath As String
Public Function Extract(pszFile As String, nIconIndex As UInteger, ByRef phiconLarge As IntPtr, ByRef phiconSmall As IntPtr, nIconSize As UInteger) As Integer Implements IExtractIcon.Extract
Dim icoHandle As IntPtr = New Icon("C:\Users\PERSONALE\Desktop\DtmIcon.ico").Handle
phiconLarge = icoHandle
phiconSmall = icoHandle
Return 0
End Function
Public Function GetIconLocation(uFlags As UInteger, szIconFile As StringBuilder, cchMax As Integer, ByRef piIndex As Integer, ByRef pwFlags As UInteger) As Integer Implements IExtractIcon.GetIconLocation
Return 0
End Function
Public Sub GetClassID(ByRef pClassID As Guid) Implements IPersistFile.GetClassID
pClassID = Me.GetType.GUID
End Sub
Public Sub GetCurFile(ByRef ppszFileName As String) Implements IPersistFile.GetCurFile
ppszFileName = Nothing
End Sub
Public Function IsDirty() As Integer Implements IPersistFile.IsDirty
Return 0
End Function
Public Sub Load(pszFileName As String, dwMode As Integer) Implements IPersistFile.Load
FilePath = pszFileName
End Sub
Public Sub Save(pszFileName As String, fRemember As Boolean) Implements IPersistFile.Save
End Sub
Public Sub SaveCompleted(pszFileName As String) Implements IPersistFile.SaveCompleted
End Sub
End Class
<ComImport, Guid("000214fa-0000-0000-c000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IExtractIcon
<PreserveSig> _
Function GetIconLocation(ByVal uFlags As UInteger, ByVal szIconFile As StringBuilder, ByVal cchMax As Integer, ByRef piIndex As Integer, ByRef pwFlags As UInteger) As Integer
<PreserveSig> _
Function Extract(ByVal pszFile As String, ByVal nIconIndex As UInteger, ByRef phiconLarge As IntPtr, ByRef phiconSmall As IntPtr, ByVal nIconSize As UInteger) As Integer
End Interface
Hvad gør jeg forkert?.