Dan pada artikel ini saya akan share bagaimana caranya merubah setting Regional and Language Options ke English (United States) secara paksa setiap aplikasi kita dijalankan.
Sebelum kita bercoding ria ada baiknya kita mengetahui dimana lokasi penyimpanan Setting Regional and Language Options di registry windows.
Option Explicit
Private Declare Function RegCloseKey Lib "advapi32.dll" ( ByVal hKey As Long ) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" ( ByVal hKey As Long , ByVal lpSubKey As String , phkResult As Long ) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( ByVal hKey As Long , ByVal lpValueName As String , ByVal Reserved As Long , ByVal dwType As Long , lpData As Any , ByVal cbData As Long ) As Long
Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" ( ByVal Locale As Long , ByVal LCType As Long , ByVal lpLCData As String , ByVal cchData As Long ) As Long
Private Const HKEY_CURRENT_USER = & H80000001
Private Const LOCALE_SENGCOUNTRY As Long = & H1002 ' English name of country
Private Const LOCALE_USER_DEFAULT As Long = & H400
Private Const REGIONAL_SETTING As String = "United States"
Private Const REG_SZ = 1 ' Unicode nul terminated string
Private Sub saveToWindowsRegistry ( hKey As Long , strPath As String , strValue As String , strData As String )
Dim ret As Long
On Error Resume Next
'Create a new key
RegCreateKey hKey , strPath , ret
'Save a string to the key
RegSetValueEx ret , strValue , 0 , REG_SZ , ByVal strData , Len ( strData )
'close the key
RegCloseKey ret
End Sub
Private Function getInfoRegionalSettings ( ByVal lInfo As Long ) As String
Dim buffer As String , ret As String
On Error Resume Next
buffer = String $ ( 256 , 0 )
ret = GetLocaleInfo ( LOCALE_USER_DEFAULT , lInfo , buffer , Len ( buffer ))
If ret > 0 Then
getInfoRegionalSettings = Left $ ( buffer , ret - 1 )
Else
getInfoRegionalSettings = ""
End If
End Function
Public Sub setDefRegionalSetting ()
If getInfoRegionalSettings ( LOCALE_SENGCOUNTRY ) <> REGIONAL_SETTING Then
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iCountry" , "1" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iCurrDigits" , "2" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iCurrency" , "0" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iDate" , "0" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iDigits" , "2" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iLZero" , "1" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iMeasure" , "1" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iNegCurr" , "0" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iTime" , "0" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iTLZero" , "0" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "Locale" , "00000409" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "s1159" , "AM" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "s2359" , "PM" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sCountry" , "United States" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sCurrency" , "$" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sDate" , "/" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sDecimal" , "." )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sLanguage" , "ENU" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sList" , "," )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sLongDate" , "dddd, MMMM dd, yyyy" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sShortDate" , "M/d/yyyy" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sThousand" , "," )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sTime" , ":" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sTimeFormat" , "h:mm:ss tt" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iTimePrefix" , "0" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sMonDecimalSep" , "." )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sMonThousandSep" , "," )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iNegNumber" , "1" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sNativeDigits" , "0123456789" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "NumShape" , "1" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iCalendarType" , "1" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iFirstDayOfWeek" , "6" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "iFirstWeekOfYear" , "0" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sGrouping" , "3;0" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sMonGrouping" , "3;0" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sPositiveSign" , "" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International" , "sNegativeSign" , "-" )
Call saveToWindowsRegistry ( HKEY_CURRENT_USER , "Control Panel\International\Geo" , "Nation" , "244" )
End If
End Sub
Comments