|
' API 関数定義
Private Declare Function SHGetSpecialFolderPath Lib _
"Shell32" Alias "SHGetSpecialFolderPathA" ( _
ByVal hWnd As Long, _
ByVal lpPath As String, _
ByVal nFolder As Long, _
ByVal fCreate As Boolean) As Boolean
' フォルダID
Private Const CSIDL_PROGRAMS = 2
' プログラムメニューのパスを取得するサンプル
Public Function GetProgramMenuDir()
Dim strTemp As String * 256
Dim intPoint As Integer
Dim strPath As String
' プログラムメニューのパスを取得
If SHGetSpecialFolderPath( _
0, strTemp, CSIDL_PROGRAMS, False) Then
' 余計なNULL文字を削除
intPoint = InStr(strTemp, Chr(0))
strPath = Left(strTemp, intPoint - 1)
End If
GetProgramMenuDir = strPath
End Function
|