VERIFICAR SE EXISTE ATALHO NA AREA TRABALHO

CCRISANEVB 30/11/2009 22:20:28
#328888
Oi...Alguém saberia como fazer, para verificar se existe determinado atalho de um programa na área de trabalho, e caso ñ exista, criar...

WCOSTA 15/12/2009 11:49:45
#329745
Para criar é fácil:
  [ô]Source: MSDN column [ô]Ask Dr. GUI[ô]
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 = [Ô]Shortcut To Calculator[Ô]
strLinkPath = [Ô]c:\Windows\calc.exe[Ô]
strLinkArguments = [Ô][Ô]
fPrivate = True [ô] Add shortcut to desktop.
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 [Ô]Created desktop shortcut[Ô]
Else
MsgBox [Ô]Unable To create desktop shortcut[Ô]
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

Agora é só trabalhar na rotina para verificar se o atalho está no desktop.
TECLA 15/12/2009 13:13:54
#329752
Resposta escolhida
Para validar se existe, fiz um POG...
Dim Path As String, App As String
App = [Ô]Google Chrome.lnk[Ô]
Path = Environ([Ô]SystemDrive[Ô]) & [Ô]\Documents and Settings\[Ô] & Environ([Ô]USERNAME[Ô]) & [Ô]\Desktop\[Ô]
If Dir(Path & App, vbArchive) = [Ô][Ô] Then
MsgBox [Ô]Não tem[Ô]
Else
MsgBox [Ô]Tem[Ô]
End If

Veja se funciona!
Tópico encerrado , respostas não são mais permitidas