Attribute VB_Name = "system"
Option Explicit
'get associated program


 Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long

'get version
Private Declare Function GetVersion Lib "kernel32" () As Long

 Declare Function GetSystemDirectory Lib "kernel32.dll" Alias "GetSystemDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long

 Private Declare Function GetTempDirectory Lib "kernel32.dll" Alias "GetTempPathA" _
  (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
  
  Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" _
 (ByVal lpBuffer As String, ByVal nSize As Long) As Long



Public Function GetSystemPath()


  'sysdir****************************
  Dim RetVal As Long
  Dim SysDir As String
  
  SysDir = Space$(256)
  RetVal = GetSystemDirectory(SysDir, Len(SysDir))

  If RetVal <> 0 Then
    GetSystemPath = Left$(SysDir, RetVal)
  End If

End Function

Public Function GetTempPath()
'temp path***************************
Dim RetVal As Long
  Dim TempDir As String
  
  TempDir = Space$(256)
  RetVal = GetTempDirectory(Len(TempDir), TempDir)

  If RetVal <> 0 Then
    GetTempPath = Left$(TempDir, RetVal)
  End If
  
  End Function
  
Public Function GetWinPath()
'win dir*****************************
Dim RetVal As Long
Dim windir As String
windir = Space$(256)
  RetVal = GetWindowsDirectory(windir, Len(windir))

  If RetVal <> 0 Then
    GetWinPath = Left$(windir, RetVal)

  End If



End Function

Public Function GetWinVersion() As String
    Dim Ver As Long, WinVer As Long
    Ver = GetVersion()
    WinVer = Ver And &HFFFF&
    'retrieve the windows version
    GetWinVersion = Format((WinVer Mod 256) + ((WinVer \ 256) / 100), "Fixed")
End Function


