January 1, 2005

WinTask - GetTimeZoneInformation

'
' GetTimeZoneInformation
'
' Author: Joe Strazzere
'

'Type TIME_ZONE_INFORMATION
'        Bias As Long
'        StandardName(32) As Integer
'        StandardDate As SYSTEMTIME
'        StandardBias As Long
'        DaylightName(32) As Integer
'        DaylightDate As SYSTEMTIME
'        DaylightBias As Long
'End Type
'Private Type SYSTEMTIME
'    wYear As Integer
'    wMonth As Integer
'    wDayOfWeek As Integer
'    wDay As Integer
'    wHour As Integer
'    wMinute As Integer
'    wSecond As Integer
'    wMilliseconds As Integer
'End Type
    wYear As Integer
    wMonth As Integer
    wDayOfWeek As Integer
    wDay As Integer
    wHour As Integer
    wMinute As Integer
    wSecond As Integer
    wMilliseconds As Integer
End Type

dim ptr as unsigned
dim ptr2 as unsigned
ptr=allocate(500)        '4 bytes
pokestring(ptr,"                                                                                   ",1)

'Declare Function GetTimeZoneInformation Lib "kernel32" Alias "GetTimeZoneInformation" (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long
b = External("kernel32","GetTimeZoneInformation",ptr)
ptr2=ptr+0
Bias= peekinteger(ptr2,4)
msgbox("Bias = "+str$(Bias))
i=4
StandardName$=""
while i < 69
  ptr2=ptr+i
  StandardName$=StandardName$+peekstring$(ptr2)
  i=i+2
wend
msgbox("Standard Name = "+StandardName$)
i=80
DaylightName$=""
while i < 145
  ptr2=ptr+i
  DaylightName$=DaylightName$+peekstring$(ptr2)
  i=i+2
wend
msgbox("Daylight Name = "+DaylightName$)