[API]
OSVERSIONINFO
GetVersionExA

[INCLUDE]
AppBase
GetSpecialFolderPath
CreateDirectoryEx

[CODE]
Public Function ProfileDirectoryBase_Filenames(ByVal AppDirSubPath As String, ByVal AppDirSubPathShort As String) As String
  Dim xChar1 As String
  Dim xType1 As OSVERSIONINFO

  ProfileDirectoryBase_Filenames = AppBase(Chr(1))
  'GoTo UseAppData
  xType1.dwOSVersionInfoSize = 148&
  If Not GetVersionExA(xType1) = 0& Then
    If xType1.dwPlatformId = &H2& And xType1.dwMajorVersion > 5& Then
'UseAppData:
      xChar1 = Trim(GetSpecialFolderPath(26&, True))
      If Not Len(xChar1) = 0& Then
        If CreateDirectoryEx(xChar1 & AppDirSubPath) Then
          ProfileDirectoryBase_Filenames = xChar1 & AppDirSubPath + "\"
          ElseIf CreateDirectoryEx(xChar1 & AppDirSubPathShort) Then
          ProfileDirectoryBase_Filenames = xChar1 & AppDirSubPathShort + "\"
          End If
        End If
      End If
    End If
  End Function
