Как создать ссылку в Интернет
Public Const NOERROR = 0
Public Const CSIDL_FAVORITES = &H6
Public Const CSIDL_DESKTOPDIRECTORY = &H10
Private Type SHITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As SHITEMID
End Type
Private Declare Function SHGetPathFromIDList Lib "shell32.dll"_
Alias "SHGetPathFromIDListA" _
(ByVal pidl As Long,_
ByVal pszPath As String) As Long
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" _
(ByVal hwndOwner As Long,_
ByVal nFolder As Long,_
pidl As ITEMIDLIST) As Long
Private Function GetSpecialPath(CSIDL As Long) As String
Dim r As Long
Dim path As String
Dim IDL As ITEMIDLIST
r = SHGetSpecialFolderLocation(Me.hwnd, CSIDL, IDL)
If r = NOERROR Then
path$ = Space$(512)
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal path$)
GetSpecialPath = Left$(path, InStr(path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialPath = ""
End Function
Private Sub cmdShortcut_Click()
Dim URLpath As String
Dim CSIDLpath As String
Dim nameofLink As String
Dim ff As Integer
URLpath = "http://www.areavb.com"
CSIDLpath = GetSpecialPath(CSIDL_FAVORITES) & "\"
nameofLink = "The VB Module.url"
ff = FreeFile
Open CSIDLpath & nameofLink For Output As #ff
Print #ff, "[InternetShortcut]"
Print #ff, "URL=" & URLpath
Close #ff
End Sub
Источник: www.vbstreets.ru
|