verknüpfung auslesen

  • VB.NET

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von Executor.

    verknüpfung auslesen

    hey

    VB.NET-Quellcode

    1. Public Function LeseShellLinkPath(ByVal datei As String) As String
    2. Dim oShell As New Shell32.Shell
    3. Dim oFolder As Shell32.Folder
    4. Dim oLink As Shell32.ShellLinkObject
    5. Dim sPath As String
    6. Dim sFile As String
    7. Dim sLinkFile As String = datei
    8. ' Ordner und Dateiname extrahieren
    9. sPath = Strings.Left(sLinkFile, InStrRev(sLinkFile, "\") - 1)
    10. sFile = Mid$(sLinkFile, InStrRev(sLinkFile, "\") + 1)
    11. oFolder = oShell.NameSpace(sPath)
    12. oLink = oFolder.Items.Item(sFile).GetLink
    13. Return oLink.Path
    14. 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

    1. Private Sub ListBox1_DragEnter(ByVal sender As Object, ByVal e As _
    2. System.Windows.Forms.DragEventArgs) Handles ListBox1.DragEnter
    3. If e.Data.GetDataPresent(DataFormats.FileDrop) Then
    4. e.Effect = DragDropEffects.All
    5. End If
    6. End Sub
    7. Private Sub ListBox1_DragDrop(ByVal sender As Object, ByVal e As _
    8. System.Windows.Forms.DragEventArgs) Handles ListBox1.DragDrop
    9. If e.Data.GetDataPresent(DataFormats.FileDrop) Then
    10. Dim i As Integer
    11. MyFiles = e.Data.GetData(DataFormats.FileDrop)
    12. MsgBox(LeseShellLinkPath(MyFiles(0)))
    13. End If
    14. 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 :cursing:


    ps: hab win 7