Test Foro de elhacker.net SMF 2.1

Programación => .NET (C#, VB.NET, ASP) => Programación General => 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 (vb) [Seleccionar]
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
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 (vb) [Seleccionar]
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 
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 (vb) [Seleccionar]

'************************************   
'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