durante il processo di intallazione
come posso fare?
durante il processo di intallazione
come posso fare?
In fase di installazione, non lo so (da codice), ma ci sono software che ti permettono di fare il tutto spuntando l'apposita casella.
Mi sembra che il tool per la creazione di pacchetti per l'installazione di VB6 contenga questa voce.
Io posso aiutarti solo dandoti il codice per creare shortcut sul desktop, ma da programma.
Magari modificandolo un po' ci ricavi qualcosa.
__________________________________________________ ________
Option Explicit
Dim IconCount As Long
Dim DesktopHandle As Long
Public Enum SHOWCMDFLAGS
SHOWNORMAL = 5
SHOWMAXIMIZE = 3
SHOWMINIMIZE = 7
End Enum
Public Function CreateShellLink&(LnkName$, ExeFile$, WorkDir$, ExeArgs$, _
Iconfile$, IconIdx&, ShowCmd As SHOWCMDFLAGS)
Dim LnkFile$
Dim myPath$
Dim cShellLink As ShellLinkA
Dim cPersistFile As IPersistFile
Dim hwnd&
Const lnk$ = ".lnk"
If LnkName = "" Or ExeFile = "" Then
Exit Function
End If
myPath = App.Path
If Right$(myPath, 1) <> "\" Then myPath = myPath & "\"
LnkFile = IIf(InStr(LnkName, "\"), LnkName & lnk, myPath & LnkName & lnk)
CreateShellLink = False
On Error GoTo ErrHandler
Set cShellLink = New ShellLinkA
Set cPersistFile = cShellLink
With cShellLink
.SetPath ExeFile
If (WorkDir <> "") Then .SetWorkingDirectory WorkDir
If (ExeArgs <> "") Then .SetArguments ExeArgs
If (Iconfile <> "") Then .SetIconLocation Iconfile, IconIdx
.SetShowCmd IIf(ShowCmd = 0, SHOWNORMAL, ShowCmd)
End With
cShellLink.Resolve 0, SLR_UPDATE
cPersistFile.Save StrConv(LnkFile, vbUnicode), 0
CreateShellLink = True
ErrHandler:
Set cPersistFile = Nothing
Set cShellLink = Nothing
End Function
__________________________________________________ _____
Prova e fammi sapere.
Ciao.
Pochi giorni fa ho dovuto postare lo stesso codice per creare un link su un altro thread.
Mi sembra che era pure un TUO thread.
"Meglio un aiuto che 50 consigli"
(tratto dalle barrette Elah)
Non capisco... Quell'altro thread sembra sparito!!!
Comunque ecco il codice: (dimmi se funziona)
Private L_Welcome_MsgBox_Message_Text As String
Private L_Welcome_MsgBox_Title_Text As String
Sub Welcome()
Dim intDoIt
intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _
vbOKCancel + vbInformation, _
L_Welcome_MsgBox_Title_Text)
If intDoIt = vbCancel Then
End
End If
End Sub
Private Sub Form_Load()
L_Welcome_MsgBox_Message_Text = "Questo script creerà un collegamento a Blocco note sul desktop."
L_Welcome_MsgBox_Title_Text = "Esempio di Windows Scripting Host"
Call Welcome
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
Dim MyShortcut, MyDesktop, DesktopPath
DesktopPath = WSHShell.SpecialFolders("Desktop")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Collegamento a Blocco note.lnk")
MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings("%windir%\notepa d.exe")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("%windir%")
MyShortcut.WindowStyle = 4
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%windir%\notepa d.exe, 0")
MyShortcut.Save
MsgBox "Un collegamento a Blocco note è ora presente sul desktop"
End
End Sub
"Meglio un aiuto che 50 consigli"
(tratto dalle barrette Elah)
si funziona ho provato con blocco note ma con il mio file l'icona
non la prende
ecco il codice:
Private L_Welcome_MsgBox_Message_Text As String
Private L_Welcome_MsgBox_Title_Text As String
Sub Welcome()
Dim intDoIt
intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _
vbOKCancel + vbInformation, _
L_Welcome_MsgBox_Title_Text)
If intDoIt = vbCancel Then
End
End If
End Sub
Private Sub Form_Load()
L_Welcome_MsgBox_Message_Text = "Questo script creerà un collegamento a Blocco note sul desktop."
L_Welcome_MsgBox_Title_Text = "Esempio di Windows Scripting Host"
Call Welcome
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
Dim MyShortcut, MyDesktop, DesktopPath
DesktopPath = WSHShell.SpecialFolders("Desktop")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Collegamento a Prima Nota.lnk")
'MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings("%windir%\notepa d.exe")
MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings(App.Path & "/collegamento.frm")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings(App.Path)
MyShortcut.WindowStyle = 4
'MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%windir%\notepa d.exe, 0")
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings(App.Path & "/collegamento.frm, 0")
MyShortcut.Save
MsgBox "Un collegamento a Prima Nota è ora presente sul desktop"
End
End Sub
solo l'icona non prende grazie
ah per l'altro messaggio che ho mandato guarda non so nemmeno io perche sia stato cancellato
Allora, quando scrivi per il percorso di un'icona ("blablabla\file.exe, 0") quello "0" vuol dire che prende l'icona numero 0 contenuta nell'applicazione. Un file frm non contiene l'icona come un'applicazione, perciò dovrai prendere il file icona (.ico) con l'icona che vuoi tu (anche un pupazzetto va bene ) e nella terzultima riga metti:
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings(App.Path & "\Icona.ico")
Così dovrebbe funzionare, ma dovrai avere anche un file icona a parte...
"Meglio un aiuto che 50 consigli"
(tratto dalle barrette Elah)