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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with system api call to change regional settings

Status
Not open for further replies.

snorkle

Programmer
Apr 10, 2001
16
US
i'm a newbe to vbscripting.

My problem is that a network of computers need to change some settings without going to each computer manually. here is the code to do it in vb, but how can i get this to work if the network sysop doesn't want unfamilier executables running? Can it be done in vbscript?

Here is some code that changes the regional settings through api calls in visual basic:

'********************************************************
Private Const LOCALE_SSHORTDATE = &H1F
Private Const WM_SETTINGCHANGE = &H1A
Private Const HWND_BROADCAST = &HFFFF&

Private Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String) As Boolean

Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long


Public Sub ConvertSysDate()
Dim dwLCID As Long
dwLCID = GetSystemDefaultLCID()
If SetLocaleInfo(dwLCID, LOCALE_SSHORTDATE, "MM/dd/yyyy") = _
False Then
Exit Sub
End If
PostMessage HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0
End Sub
'********************************************************
 


Haven't used it before, but there is a "SetLocale" function in vbscript. You can also run a script remotely in W2K. What are you trying to do?

Fengshui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top