Code: Select all
Procedure.l IsDotNetVersionInstalled(Version.s)
;The version string must be in this format:
;"1.0" or "1.1" or "2.0", etc.
;The framework is allways installed by Windows
;in the following folder: %windir%\Microsoft.NET\Framework\(<version>)
;This method was recommemded by a MSDN moderator
;First get Windows Directory
#CSIDL_WINDOWS = $24
WinDir.s = Space(270)
SHGetSpecialFolderLocation_(0,#CSIDL_WINDOWS,@Listptr)
SHGetPathFromIDList_(Listptr,@WinDir)
If Right(WinDir,1) <> "\"
WinDir + "\"
EndIf
DotNetDir.s = WinDir + "Microsoft.NET\Framework\"
If ExamineDirectory(0,DotNetDir,"*.*")
While NextDirectoryEntry(0)
If DirectoryEntryType(0) = #PB_DirectoryEntry_Directory
DirName.s = DirectoryEntryName(0)
If DirName <> "" And DirName <> "." And DirName <> ".."
VersionCheck.s = Trim(Mid(DirName,2,3))
If Version = VersionCheck
ProcedureReturn 1
EndIf
EndIf
EndIf
Wend
FinishDirectory(0)
EndIf
ProcedureReturn 0
EndProcedure
;Example
Debug IsDotNetVersionInstalled("1.1") ;Debugs #True if .Net 1.1 is installed