Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    [VB6] Collegamento

    Ciao ragazzi..è un bel po che non bazzico qui in giro; avrei una domanda da porvi: E' possibile fare con Visual Basic 6 un programma che crei sul desktop un collegamento ad un file scelto?

    Grazie in anticipo a tutti!!!

  2. #2
    Utente di HTML.it
    Registrato dal
    Oct 2005
    Messaggi
    117
    Declare Function fCreateShellLink Lib "STKIT432.DLL" _
    (ByVal lpstrFolderName as String ,ByVal lpstrLinkName as String _
    ByVal lpstrLinkPath as String ,ByVal lpstrLinkArgs as String ) As Long



    iLong = fCreateShellLink("..\..\Desktop", "Collegamento a Program", "C:\Path\Program.exe","")



    Ciao !

  3. #3
    Utente di HTML.it L'avatar di LMondi
    Registrato dal
    Sep 2004
    Messaggi
    1,291
    Ho trovato anche quest'API che consente ulteriori collegamenti (provato su Win_XP e VB6 esegue un collegamento con la Calcolatrice):
    codice:
    Private Declare Function fCreateShellLink Lib "vb6stkit.dll" (ByVal lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal lpstrLinkPath As String, ByVal lpstrLinkArguments As String, ByVal fPrivate As Long, ByVal sParent As String) As Long
    Private Sub Form_Load()
        
        Dim strGroupName As String, strLinkName As String
        Dim strLinkPath As String, strLinkArguments As String
        Dim fPrivate As Boolean, sParent As String
        Dim fSuccess As Boolean
        
        strLinkName = "Collegamento con Calcolatrice"
        strLinkPath = "C:\WINDOWS\system32\calc.exe"
        strLinkArguments = ""
        
        ' Aggiunge il collegamento al Desktop:
        fPrivate = True
        strGroupName = "..\..\Desktop"
        sParent = "$(Programs)"
        fSuccess = fCreateShellLink(strGroupName & vbNullChar, strLinkName, strLinkPath, strLinkArguments & vbNullChar, fPrivate, sParent)
        'the path should never be enclosed in double quotes
        If fSuccess Then
            MsgBox "Creato il collegamento col desktop"
        Else
            MsgBox "Impossibile creare il collegamento col desktop"
        End If
    '    ' Add shortcut to Programs menu.
    '    strGroupName = "$(Programs)"
    '    sParent = "$(Programs)"
    '    fSuccess = fCreateShellLink(strGroupName & vbNullChar, strLinkName, strLinkPath, strLinkArguments & vbNullChar, fPrivate, sParent)
    '    'the path should never be enclosed in double quotes
    '    If fSuccess Then
    '        MsgBox "Created shortcut on Programs menu"
    '    Else
    '        MsgBox "Unable to create shortcut on Programs menu"
    '    End If
    '    ' Add shortcut to Startup folder of Programs menu.
    '    strGroupName = "Startup"
    '    sParent = "$(Programs)"
    '    fSuccess = fCreateShellLink(strGroupName & vbNullChar, strLinkName, strLinkPath, strLinkArguments & vbNullChar, fPrivate, sParent)
    '    'the path should never be enclosed in double quotes
    '    If fSuccess Then
    '        MsgBox "Created shortcut in Startup folder"
    '    Else
    '        MsgBox "Unable to create shortcut in Startup folder"
    '    End If
    End Sub
    A mia volta vorrei sapere se c'è modo di controllare se sul desktop è già stato creato il collegamento al programma e quindi evitare di ripetere l'operazione.
    LM

  4. #4
    Utente di HTML.it
    Registrato dal
    Oct 2005
    Messaggi
    117
    Ciao, qui si trova un esempio di come leggere le icone, ma è da studiare...


    http://www.freevbcode.com/ShowCode.Asp?ID=114

  5. #5
    Utente di HTML.it L'avatar di LMondi
    Registrato dal
    Sep 2004
    Messaggi
    1,291
    Grazie pierabo
    LM

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.