Trimbel
Jun 30th, 2000, 06:15 AM
Hey guys, this is probably an easy fix but I have no idea how to do it.....
I want to place the StandardName from the TIME_ZONE_INFORMATION Structure into a label.Caption
The example from the Windows API Guide for the GetTimeZoneInformation Function is as follows...
' Display the name of the time zone the computer is set to.
' receives information on the time zone
Dim tzi As TIME_ZONE_INFORMATION
' return value
Dim retval As Long
' counter variable needed to display time zone name
Dim c As Long
' read information on the computer's selected time zone
retval = GetTimeZoneInformation(tzi)
' Oddly, instead of being stored in a string, the time zone ' name is stored in a 32-element array, each element holding ' the ASCII code of one of the characters.
' This loop converts the array into a readable string.
Debug.Print "The computer's time zone is: ";
' the array's range is from 0 to 31
For c = 0 To 31
' abort if the terminating null character is reached
If tzi.StandardName(c) = 0 Then Exit For
' convert the ASCII code into a character and display it
Debug.Print Chr(tzi.StandardName(c))
Next c
' end the line being displayed
Debug.Print ""
Well thats the example code. If you have any ideas as how to put it in a label.Caption instead of the immediate window I would be very grateful for the help.
I want to place the StandardName from the TIME_ZONE_INFORMATION Structure into a label.Caption
The example from the Windows API Guide for the GetTimeZoneInformation Function is as follows...
' Display the name of the time zone the computer is set to.
' receives information on the time zone
Dim tzi As TIME_ZONE_INFORMATION
' return value
Dim retval As Long
' counter variable needed to display time zone name
Dim c As Long
' read information on the computer's selected time zone
retval = GetTimeZoneInformation(tzi)
' Oddly, instead of being stored in a string, the time zone ' name is stored in a 32-element array, each element holding ' the ASCII code of one of the characters.
' This loop converts the array into a readable string.
Debug.Print "The computer's time zone is: ";
' the array's range is from 0 to 31
For c = 0 To 31
' abort if the terminating null character is reached
If tzi.StandardName(c) = 0 Then Exit For
' convert the ASCII code into a character and display it
Debug.Print Chr(tzi.StandardName(c))
Next c
' end the line being displayed
Debug.Print ""
Well thats the example code. If you have any ideas as how to put it in a label.Caption instead of the immediate window I would be very grateful for the help.