[quote=82863:@Michel Bujardet]Yes. I mentioned it above. You found the problem. Congratulations.
I have since incorporated in the project Dave Sysemore method of detecting the Windows version :
[code]Function GetVersion() As string
#If TargetWin32
dim OS as string = "Windows"
dim OS_CODE as integer
//try to be more specific of windows version
Soft Declare Sub GetVersionExA Lib "Kernel32" ( info As Ptr )
Soft Declare Sub GetVersionExW Lib "Kernel32" ( info As Ptr )
Dim info As MemoryBlock
If System.IsFunctionAvailable( "GetVersionExW", "Kernel32" ) Then
info = New MemoryBlock( 20 + (2 * 128) )
info.Long( 0 ) = info.Size
GetVersionExW( info )
Else
info = New MemoryBlock( 148 )
info.Long( 0 ) = info.Size
GetVersionExA( info )
End If
Dim Str As String
OS_CODE=info.Long(4)*100+info.long(8)
Select Case OS_CODE
Case 400
os = "Windows 95/NT 4.0"
Case 410
os = "Windows 98"
Case 490
os = "Windows Me"
Case 300 To 399
os = "Windows NT 3.51"
OS_CODE=30
Case 500
os = "Windows 2000"
Case 501
os = "Windows XP"
Case 502
os = "Windows Server 2003"
Case 600
os = "Windows Vista"
Case 601
os = "Windows 7"
Case 602
os = "Windows 8"
End Select
Str = " Build " + Str( info.Long( 12 ) )
If System.IsFunctionAvailable( "GetVersionExW", "Kernel32" ) Then
Str = Str + " " + Trim( info.WString( 20 ) )
Else
Str = Str + " " + Trim( info.CString( 20 ) )
End If
os = os + Str
Return os
#EndIf
End Function
[/code]
Now the method works on both XP and earlier, and reads as :
[code] Sub Action()
if not TargetWin32 then return
dim tzname as string
dim os as string = GetVersion
if instr(os, “Windows XP”)>0 then
tzname = “StandardName”
elseif instr(os, “Windows 95/NT 4.0”)>0 or instr(os, “Windows 98”)>0 or instr(os, “Windows Me”)>0 then
return
else
tzname = “TimeZoneKeyName”
end if
// get a registry key
Dim reg As New RegistryItem(“HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation”)
Dim TimeZ As String
// now we look on all values on this key
For i As Integer = 0 To reg.KeyCount- 1
Dim name As String = reg.Name(i)
Dim value As Variant = reg.Value(i)
if name = tzname then
TimeZ = reg.Value(i)
exit
end if
Next
reg = New RegistryItem(“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones”+TimeZ)
Dim TimeCities as String
// now we look on all values on this key
For i As Integer = 0 To reg.KeyCount- 1
Dim name As String = reg.Name(i)
Dim value As Variant = reg.Value(i)
if name = “Display” then
TimeCities = reg.Value(i)
exit
end if
Next
// and display the time zone as cities
MsgBox TimeZ+EndOfLine+TimeCities
End Sub
[/code]
Thanks to the OP for an interesting challenge…[/quote]
Second thought. To get Windows versions, would it not be enough to get the KEY Value from windows registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName ?