hola quiero hacer una herramienta donde te diga el idioma de windows . pero no encuentro ninguna api para hacerla si me podrian dar una mano estaria muy bien :xD
Aquí Tienes lo que necesitas, saludos ;D
Private Declare Function GetSystemDefaultLangID Lib "kernel32" () As Integer
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 Sub Form_Load()
MsgBox LangID
End Sub
Public Function LangID() As String
On Error Resume Next
Dim sBuf As String * 255
Dim l As Long
LCID = GetSystemDefaultLangID()
l = GetLocaleInfo(LCID, &H4, sBuf, Len(sBuf))
LangID = Left(sBuf, l)
End Function
Por si necesitas información sobre las 2 apis
GetLocaleInfo:
http://allapi.mentalis.org/apilist/GetLocaleInfo.shtml
GetSystemDefaultLangID:
http://msdn.microsoft.com/en-us/library/aa913453.aspx
muchas gracias me sirvio vastante ;D
es posible saber en q pais estas o no
Public Function ObtenerIdioma(ByVal lInfo As Long) As String
Dim Buffer As String, Ret As String
Buffer = String$(256, 0)
Ret = GetLocaleInfo(LOCALE_USER_DEFAULT, lInfo, Buffer, Len(Buffer))
'Si Ret devuelve 0 es porque falló la llamada al Api
If Ret > 0 Then
ObtenerIdioma = Left$(Buffer, Ret - 1)
Else
ObtenerIdioma = ""
End If
End Function
'Mostramos el mensaje con el idioma del Sistema y el país
'*********************************************************
Private Sub Command1_Click()
MsgBox "Usted vive en: " & ObtenerIdioma(LOCALE_SENGCOUNTRY) _
& " (" & ObtenerIdioma(LOCALE_SNATIVECTRYNAME) & ")," & _
vbCrLf & "y el idioma es: " & ObtenerIdioma(LOCALE_SENGLANGUAGE) & " (" & ObtenerIdioma(LOCALE_SNATIVELANGNAME) & ").", vbInformation
End Sub
Por las dudas...
Option Explicit
'************************************
'Constantes para el Api GetLocaleInfo
'************************************
Const LOCALE_USER_DEFAULT = &H400
Const LOCALE_SENGCOUNTRY = &H1002
Const LOCALE_SENGLANGUAGE = &H1001
Const LOCALE_SNATIVELANGNAME = &H4
Const LOCALE_SNATIVECTRYNAME = &H8
'Declaración de la función Api GetLocaleInfo
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