Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: rembolso en 16 Mayo 2009, 05:47 am



Título: como saber el idioma de windows
Publicado por: rembolso en 16 Mayo 2009, 05:47 am
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


Título: Re: como saber el idioma de windows
Publicado por: XcryptOR en 16 Mayo 2009, 06:20 am
Aquí Tienes lo que necesitas, saludos  ;D

Código
  1. Private Declare Function GetSystemDefaultLangID Lib "kernel32" () As Integer
  2.  
  3. Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" ( _
  4. ByVal Locale As Long, _
  5. ByVal LCType As Long, _
  6. ByVal lpLCData As String, _
  7. ByVal cchData As Long) As Long
  8.  
  9. Private Sub Form_Load()
  10.    MsgBox LangID
  11. End Sub
  12. Public Function LangID() As String
  13.    On Error Resume Next
  14.    Dim sBuf        As String * 255
  15.    Dim l           As Long
  16.    LCID = GetSystemDefaultLangID()
  17.    l = GetLocaleInfo(LCID, &H4, sBuf, Len(sBuf))
  18.    LangID = Left(sBuf, l)
  19. End Function
  20.  


Título: Re: como saber el idioma de windows
Publicado por: YST en 16 Mayo 2009, 09:06 am
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


Título: Re: como saber el idioma de windows
Publicado por: rembolso en 24 Mayo 2009, 23:48 pm
muchas gracias me sirvio vastante  ;D


Título: Re: como saber el idioma de windows
Publicado por: rembolso en 25 Mayo 2009, 00:01 am
es posible saber en q pais estas o no


Título: Re: como saber el idioma de windows
Publicado por: h0oke en 25 Mayo 2009, 00:04 am
 
Código
  1. Public Function ObtenerIdioma(ByVal lInfo As Long) As String  
  2.     Dim Buffer As String, Ret As String  
  3.     Buffer = String$(256, 0)  
  4.  
  5.  
  6.     Ret = GetLocaleInfo(LOCALE_USER_DEFAULT, lInfo, Buffer, Len(Buffer))  
  7.     'Si Ret devuelve 0 es porque falló la llamada al Api  
  8.     If Ret > 0 Then  
  9.  
  10.         ObtenerIdioma = Left$(Buffer, Ret - 1)  
  11.     Else  
  12.         ObtenerIdioma = ""  
  13.     End If  
  14. End Function  
  15.  
  16.  
  17. 'Mostramos el mensaje con el idioma del Sistema y el país  
  18. '*********************************************************  
  19. Private Sub Command1_Click()  
  20.  
  21.     MsgBox "Usted vive en: " & ObtenerIdioma(LOCALE_SENGCOUNTRY) _  
  22.            & " (" & ObtenerIdioma(LOCALE_SNATIVECTRYNAME) & ")," & _  
  23.            vbCrLf & "y el idioma es: " & ObtenerIdioma(LOCALE_SENGLANGUAGE)       & " (" & ObtenerIdioma(LOCALE_SNATIVELANGNAME) & ").", vbInformation    
  24. End Sub  


Título: Re: como saber el idioma de windows
Publicado por: h0oke en 25 Mayo 2009, 00:19 am
Por las dudas...

 Option Explicit  
 
Código
  1.  
  2. '************************************  
  3. 'Constantes para el Api GetLocaleInfo  
  4. '************************************  
  5. Const LOCALE_USER_DEFAULT = &H400  
  6. Const LOCALE_SENGCOUNTRY = &H1002  
  7. Const LOCALE_SENGLANGUAGE = &H1001  
  8. Const LOCALE_SNATIVELANGNAME = &H4  
  9. Const LOCALE_SNATIVECTRYNAME = &H8  
  10.  
  11. 'Declaración de la función Api GetLocaleInfo  
  12. Private Declare Function GetLocaleInfo _  
  13.     Lib "kernel32" _  
  14.     Alias "GetLocaleInfoA" ( _  
  15.         ByVal Locale As Long, _  
  16.         ByVal LCType As Long, _  
  17.         ByVal lpLCData As String, _  
  18.         ByVal cchData As Long) As Long