VB Code:
Private Declare Function SHGetSpecialFolderPath _
Lib "shell32.dll" Alias "SHGetSpecialFolderPathA" ( _
ByVal hWnd As Long, _
ByVal pszPath As String, _
ByVal csidl As Long, _
ByVal fCreate As Long _
) As Long
Public Function GetDesktopPath() As String
Const CSIDL_DESKTOPDIRECTORY As Long = &H10
Const MAX_PATH As Long = 260
Dim sPath As String
sPath = Space(MAX_PATH)
SHGetSpecialFolderPath(0, sPath, CSIDL_DESKTOPDIRECTORY, False)
GetDesktopPath = Left$(sPath, InStr(sPath, vbNullString) - 1)
End Function
Public Function GetStartMenuPath(Optional ByVal blnAllUsers As Boolean)
Const CSIDL_COMMON_STARTMENU As Long = &H16
Const CSIDL_STARTMENU As Long = &Hb
Const MAX_PATH As Long = 260
Dim sPath As String, nFlag As Long
sPath = Space(MAX_PATH)
If blnAllUsers = True Then
nFlag = CSIDL_COMMON_STARTMENU
Else
nFlag = CSIDL_STARTMENU
End If
SHGetSpecialFolderPath(0, sPath, nFlag, False)
GetStartMenuPath = Left$(sPath, InStr(sPath, vbNullString) - 1)
End Function
Call GetDesktopPath to get the physical path of where the desktop shortcut items are stored. Call GetStartMenuPath for the Start menu Programs folder, pass True to it if you want it for all the users or pass False or nothing at all to get the path for the current user only.