Private Type SHITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As SHITEMID
End Type
Private Declare Function SHGetSpecialFolderPath Lib "shell32.dll" Alias "SHGetSpecialFolderPathA" (ByVal hwndOwner As Long, ByVal lpszPath As String, ByVal nFolder As Long, ByVal fCreate As Long) As Long
Private Const CSIDL_DESKTOP = &H0
Private Sub Command1_Click()
Dim strPath As String * 255
SHGetSpecialFolderPath Me.hWnd, strPath, CSIDL_DESKTOP, False '取桌面路径
Mid(strPath, InStr(strPath, Chr(0))) = "-abc"
StrURLFile = Trim(strPath)
Print StrURLFile
End Sub
Dim strPath As String * 255
SHGetSpecialFolderPath Me.hWnd, strPath, CSIDL_COMMON_DESKTOPDIRECTORY, False '取桌面路径
StrURLFile = GetValidString(strPath) & "-abc"
Print StrURLFile
Private Function GetValidString(strData As String) As String
Dim nLen As Integer
Dim strRet As String
Dim i As Integer
strRet = ""
nLen = Len(strData)
For i = 1 To nLen
If Asc(Mid(strData, i, 1)) = 0 Then
strRet = Left(strData, i - 1)
Exit For
End If
Next
GetValidString = strRet
End Function