Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binary array into user defined Type (How to?)

Status
Not open for further replies.

Tomeczek

Programmer
Oct 25, 2012
40
0
0
US
I have following problem in my VB6 project:

I'm trying to read certain Time Zone information from Registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\<the zone>).

(the zone I'm looking for is not a zone I'm in; potentially, I have to get to every zone)

I use WMI to create objRegistry object and I am executing objRegistry.GetBinaryValue to get "TZI" value:

iRet=objRegistry.GetBinaryValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\<the zone>", "TZI", aTZI).
aTZI variant becomes an array of 44 bytes.


I also have defined a user types and a variable:

Public 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

Public Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(0 To 63) As Byte
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(0 To 63) As Byte
DaylightDate As SYSTEMTIME
DaylightBias As Long​
End Type


Public zoneTZI As TIME_ZONE_INFORMATION


How can I get aTZI into zoneTZI, so that I can read each element of the zone?

Whatever I try to do gets me an error "Only user-defined in public object modules can be coerced to or from a variant or passed to late-bound functions"
Every suggestion will be appreciated.

Thanks!



 
In the first instance, the following thread may be of interest: thread222-1485446
 
Did yiu get anywhere with this, or do you require further advice?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top