Sne, та пожелей ты чела Какой там нафиг поиск
-----------------------------------------
Enum ShortCutDest
 eskTop
Programs
StartMenu
StartUp
End Enum
Public Function CreateLink(dest As ShortCutDest, ByVal sName As String, ByVal sPath As String, Optional HotKey As String = "", Optional sIcon As String = "", Optional sWorkingDirectory As String = "", Optional sSubFolder As String = "", Optional WinStyle As Integer = vbNormalFocus)
 im WshShell As Object
 im oShellLink As Object
 im sLinkPath As String
Set WshShell = CreateObject("WScript.Shell"
Select Case dest
Case DeskTop
sLinkPath = WshShell.SpecialFolders("esktop"
Case StartMenu
sLinkPath = WshShell.SpecialFolders("StartMenu"
Case StartUp
sLinkPath = WshShell.SpecialFolders("StartUp"
Case Programs
sLinkPath = WshShell.SpecialFolders("Programs"
End Select
On Error Resume Next
If sSubFolder <> "" Then
sLinkPath = sLinkPath & "\" & sSubFolder
If Dir(sLinkPath) = "" Then MkDir sLinkPath
End If
On Error GoTo 0
Set oShellLink = WshShell.CreateShortCut(sLinkPath & "\" & sName & ".lnk"
oShellLink.WindowStyle = WinStyle
oShellLink.HotKey = sHotKey
oShellLink.TargetPath = sPath
oShellLink.IconLocation = sIcon
oShellLink.Description = sName
oShellLink.WorkingDirectory = sWorkingDirectory
oShellLink.Save
Set oShellLink = Nothing
Set WshShell = Nothing
End Function
Private Sub Command1_Click()
CreateLink DeskTop, "Calculator", "c:\windows\calc.exe", "CTRL+SHIFT+C", "calc.exe,0", "c:\windows"
CreateLink StartMenu, "Calculator", "c:\windows\calc.exe", "CTRL+SHIFT+C", "calc.exe,0", "c:\windows"
CreateLink StartUp, "Calculator", "c:\windows\calc.exe", "CTRL+SHIFT+C", "calc.exe,0", "c:\windows"
CreateLink Programs, "Calculator", "c:\windows\calc.exe", "CTRL+SHIFT+C", "calc.exe,0", "c:\windows", "WinCalc"
CreateLink Programs, "Calculator Help", "c:\windows\help\calc.hlp", "", "winhlp32.exe,0", "c:\windows\help", "WinCalc"
CreateLink Programs, "Visit our web site", "http://vbcity.com", , "shdocvw.dll,0", , "WinCalc", vbMaximizedFocus
End Sub
Ответить
|