Option ExplicitConst CSIDL_DESKTOP = &H0Const CSIDL_PROGRAMS = &H2
Private Type SHITEMIDcb As LongabID As ByteEnd TypePrivate Type ITEMIDLISTmkid As SHITEMIDEnd TypePrivate Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As LongPrivate Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As LongPrivate Function GetSpecialfolder(CSIDL As Long) As String
Dim lRet As Long
Dim IDL As ITEMIDLIST
Dim sPath As String
lRet = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If lRet = 0 Then
sPath = Space$(512)
lRet = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal sPath)
GetSpecialfolder = Left$(sPath, InStr(sPath, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End FunctionPrivate Sub cmdMakeLnk_Click()Dim sProgramsPath As StringDim sDesktopPath As StringsProgramsPath = GetSpecialfolder(CSIDL_PROGRAMS)sDesktopPath = GetSpecialfolder(CSIDL_DESKTOP)txtLnk.LinkTopic = "Progman|Progman"txtLnk.LinkMode = 2
txtLnk.LinkExecute "[AddItem(""ie.exe"",""ie"" )]"前面都能正常运行 后面是将 开始\程序\ie.exe 文件剪切到桌面 可是老出错 说是找不到
文件 请高手解决sProgramsPath = sProgramsPath & "\ie.lnk"
sDesktopPath = sDesktopPath & "\ie.lnk"
FileCopy sProgramsPath, sDesktopPath
Kill sProgramsPathEnd Sub
Private Type SHITEMIDcb As LongabID As ByteEnd TypePrivate Type ITEMIDLISTmkid As SHITEMIDEnd TypePrivate Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As LongPrivate Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As LongPrivate Function GetSpecialfolder(CSIDL As Long) As String
Dim lRet As Long
Dim IDL As ITEMIDLIST
Dim sPath As String
lRet = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If lRet = 0 Then
sPath = Space$(512)
lRet = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal sPath)
GetSpecialfolder = Left$(sPath, InStr(sPath, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End FunctionPrivate Sub cmdMakeLnk_Click()Dim sProgramsPath As StringDim sDesktopPath As StringsProgramsPath = GetSpecialfolder(CSIDL_PROGRAMS)sDesktopPath = GetSpecialfolder(CSIDL_DESKTOP)txtLnk.LinkTopic = "Progman|Progman"txtLnk.LinkMode = 2
txtLnk.LinkExecute "[AddItem(""ie.exe"",""ie"" )]"前面都能正常运行 后面是将 开始\程序\ie.exe 文件剪切到桌面 可是老出错 说是找不到
文件 请高手解决sProgramsPath = sProgramsPath & "\ie.lnk"
sDesktopPath = sDesktopPath & "\ie.lnk"
FileCopy sProgramsPath, sDesktopPath
Kill sProgramsPathEnd Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货