|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to change computer's "Time Zone" from vb.netplease help.
I want to be able to change my computer's system "Time Zone" via vb.net code. is it possible? -mike On Tue, 30 May 2006 16:38:04 +0800, "Michael Barrido"
<jm***@hotmail.com> wrote: >please help. The short answer is "Probably".>I want to be able to change my computer's system "Time Zone" via vb.net >code. is it possible? > >-mike > I had an old example of this written in VB6 for use in Win98. The basis of the example uses the API, SetTimeZoneInformation which, in Net, would be: Public Declare Function SetTimeZoneInformation _ Lib "kernel32" (ByRef lpTimeZoneInformation _ As TIME_ZONE_INFORMATION) As Integer However, the old TYPE definition for TIME_ZONE_INFORMATION would not be valid for NT systems and NET. Public Type TIME_ZONE_INFORMATION Bias As Long StandardName(31) As Integer StandardDate As SYSTEMTIME StandardBias As Long DaylightName(31) As Integer DaylightDate As SYSTEMTIME DaylightBias As Long End Type You would need to update this to a valid working Structure. I found 3 different versions using a quick "google", with this one looking the most ominous: Public Structure TIME_ZONE_INFORMATION Dim Bias As Integer <VBFixedString(64), System.Runtime.InteropServices. _ MarshalAs(System.Runtime.InteropServices. _ UnmanagedType.ByValTStr, SizeConst:=64)> _ Public StandardName As String Dim StandardDate As SYSTEMTIME Dim StandardBias As Integer <VBFixedString(64), System.Runtime.InteropServices. _ MarshalAs(System.Runtime.InteropServices. _ UnmanagedType.ByValTStr, SizeConst:=64)> _ Public DaylightName As String Dim DaylightDate As SYSTEMTIME Dim DaylightBias As Integer End Structure TimeZone definitions for a given system are found in the registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones Theoretically, you should be able to set the system time zone to any one of those named Time Zones. Long answer: Yes, but would depend on you NET skill level. Gene
Check if an object is treatable as string/char
Common VB nomenclature Thread issue ?? Data in datagridview from a text file Working with multiple displays referencing cells in Excel and finding empty cells Access to Access Database Need I internet programming with Socket? create registry value - bug in VS? ActiveX can't creat object? |
|||||||||||||||||||||||