hey
ich hab den cod im Internet gefunden aber der geht leider nit ! wenn ich per Drag-Drop eine Verknüpfung in eine listbox rein zihe
Drag-Drop code
VB sagt mir das ich nicht die rechte und .... habe. Daraufhin habe ich als Admn VB gestartet und jetzt geht das Drag-Drop nit mehr
ps: hab win 7
VB.NET-Quellcode
- Public Function LeseShellLinkPath(ByVal datei As String) As String
- Dim oShell As New Shell32.Shell
- Dim oFolder As Shell32.Folder
- Dim oLink As Shell32.ShellLinkObject
- Dim sPath As String
- Dim sFile As String
- Dim sLinkFile As String = datei
- ' Ordner und Dateiname extrahieren
- sPath = Strings.Left(sLinkFile, InStrRev(sLinkFile, "\") - 1)
- sFile = Mid$(sLinkFile, InStrRev(sLinkFile, "\") + 1)
- oFolder = oShell.NameSpace(sPath)
- oLink = oFolder.Items.Item(sFile).GetLink
- Return oLink.Path
- End Function
ich hab den cod im Internet gefunden aber der geht leider nit ! wenn ich per Drag-Drop eine Verknüpfung in eine listbox rein zihe
Drag-Drop code
VB.NET-Quellcode
- Private Sub ListBox1_DragEnter(ByVal sender As Object, ByVal e As _
- System.Windows.Forms.DragEventArgs) Handles ListBox1.DragEnter
- If e.Data.GetDataPresent(DataFormats.FileDrop) Then
- e.Effect = DragDropEffects.All
- End If
- End Sub
- Private Sub ListBox1_DragDrop(ByVal sender As Object, ByVal e As _
- System.Windows.Forms.DragEventArgs) Handles ListBox1.DragDrop
- If e.Data.GetDataPresent(DataFormats.FileDrop) Then
- Dim i As Integer
- MyFiles = e.Data.GetData(DataFormats.FileDrop)
- MsgBox(LeseShellLinkPath(MyFiles(0)))
- End If
- End Sub
VB sagt mir das ich nicht die rechte und .... habe. Daraufhin habe ich als Admn VB gestartet und jetzt geht das Drag-Drop nit mehr
ps: hab win 7