Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
François Picalausa
Hello,
tu peux assayer avec GetLocaleInfo et LOCALE_SLANGUAGE s'il s'agit d'afficher le nom. En utilisant GetThreadLocale, tu pourra renseigner le premier paramètre. (http://msdn.microsoft.com/library/en-us/intl/nls_34rz.asp)
Sinon, pour traiter la valeur par le code : GetSystemDefaultLangID ou GetUserDefaultLangID ou ... Voir: http://msdn.microsoft.com/library/en-us/intl/nls_4ppg.asp
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"Pascal B." <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit dans le message de news:
Bonjour à tous,
Comment puis-je connaître la langue du Windows sous lequel est installé mon programme ?
Pascal?
Hello,
tu peux assayer avec GetLocaleInfo et LOCALE_SLANGUAGE s'il s'agit
d'afficher le nom.
En utilisant GetThreadLocale, tu pourra renseigner le premier paramètre.
(http://msdn.microsoft.com/library/en-us/intl/nls_34rz.asp)
Sinon, pour traiter la valeur par le code : GetSystemDefaultLangID ou
GetUserDefaultLangID ou ...
Voir: http://msdn.microsoft.com/library/en-us/intl/nls_4ppg.asp
--
François Picalausa (MVP VB)
http://faq.vb.free.fr --- http://msdn.microsoft.com
http://apisvb.europe.webmatrixhosting.net
"Pascal B." <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit dans le
message de news:uSwIFrEWEHA.2928@tk2msftngp13.phx.gbl
Bonjour à tous,
Comment puis-je connaître la langue du Windows sous lequel est
installé mon programme ?
tu peux assayer avec GetLocaleInfo et LOCALE_SLANGUAGE s'il s'agit d'afficher le nom. En utilisant GetThreadLocale, tu pourra renseigner le premier paramètre. (http://msdn.microsoft.com/library/en-us/intl/nls_34rz.asp)
Sinon, pour traiter la valeur par le code : GetSystemDefaultLangID ou GetUserDefaultLangID ou ... Voir: http://msdn.microsoft.com/library/en-us/intl/nls_4ppg.asp
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"Pascal B." <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit dans le message de news:
Bonjour à tous,
Comment puis-je connaître la langue du Windows sous lequel est installé mon programme ?
Pascal?
Christian HUBERT-HUGOUD- Xtrem7
Essaye ceci :
Function OSLanguage() As String Dim LanguageID&
LanguageID = GetSystemDefaultLangID()
Select Case LanguageID Case &H401: OSLanguage = "arabic" Case &H402: OSLanguage = "bulgarian" Case &H403: OSLanguage = "catalan" Case &H404: OSLanguage = "traditional_chinese" Case &H405: OSLanguage = "czech" Case &H406: OSLanguage = "danish" Case &H407: OSLanguage = "deutsch" Case &H408: OSLanguage = "greek" Case &H409: OSLanguage = "us_english" Case &H40A: OSLanguage = "castillan_spanish" Case &H40B: OSLanguage = "finnish" Case &H40C: OSLanguage = "français" Case &H40D: OSLanguage = "hebrew" Case &H40E: OSLanguage = "hungarian" Case &H40F: OSLanguage = "icelandic" Case &H410: OSLanguage = "italian" Case &H411: OSLanguage = "japanese" Case &H412: OSLanguage = "korean" Case &H413: OSLanguage = "dutch" Case &H414: OSLanguage = "norvegian_bokmal" Case &H415: OSLanguage = "polish" Case &H416: OSLanguage = "brazilian_portugese" Case &H417: OSLanguage = "rhaeto_romanic" Case &H418: OSLanguage = "romanian" Case &H419: OSLanguage = "russian" Case &H41A: OSLanguage = "serbo_croatian_latin" Case &H41B: OSLanguage = "slovak" Case &H41C: OSLanguage = "albanian" Case &H41D: OSLanguage = "swedish" Case &H41E: OSLanguage = "thai" Case &H41F: OSLanguage = "turkish" Case &H420: OSLanguage = "urdu" Case &H421: OSLanguage = "bahasa" Case &H804: OSLanguage = "simplified_chinese" Case &H807: OSLanguage = "swiss_german" Case &H809: OSLanguage = "uk_english" Case &H80A: OSLanguage = "mexican_spanish" Case &H80C: OSLanguage = "belgian_french" Case &H810: OSLanguage = "swiss_italian" Case &H813: OSLanguage = "belgian_dutch" Case &H814: OSLanguage = "norvegian_nynorsk" Case &H816: OSLanguage = "portugese" Case &H81A: OSLanguage = "serbo_croatian_cyrillic" Case &HC0C: OSLanguage = "canadian_french" Case &H100C: OSLanguage = "swiss_french" Case Else: OSLanguage = "uk_english" End Select
End Function
"Pascal B." <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit dans le message de news:
Bonjour à tous,
Comment puis-je connaître la langue du Windows sous lequel est installé
mon programme ?
Pascal?
Essaye ceci :
Function OSLanguage() As String
Dim LanguageID&
LanguageID = GetSystemDefaultLangID()
Select Case LanguageID
Case &H401: OSLanguage = "arabic"
Case &H402: OSLanguage = "bulgarian"
Case &H403: OSLanguage = "catalan"
Case &H404: OSLanguage = "traditional_chinese"
Case &H405: OSLanguage = "czech"
Case &H406: OSLanguage = "danish"
Case &H407: OSLanguage = "deutsch"
Case &H408: OSLanguage = "greek"
Case &H409: OSLanguage = "us_english"
Case &H40A: OSLanguage = "castillan_spanish"
Case &H40B: OSLanguage = "finnish"
Case &H40C: OSLanguage = "français"
Case &H40D: OSLanguage = "hebrew"
Case &H40E: OSLanguage = "hungarian"
Case &H40F: OSLanguage = "icelandic"
Case &H410: OSLanguage = "italian"
Case &H411: OSLanguage = "japanese"
Case &H412: OSLanguage = "korean"
Case &H413: OSLanguage = "dutch"
Case &H414: OSLanguage = "norvegian_bokmal"
Case &H415: OSLanguage = "polish"
Case &H416: OSLanguage = "brazilian_portugese"
Case &H417: OSLanguage = "rhaeto_romanic"
Case &H418: OSLanguage = "romanian"
Case &H419: OSLanguage = "russian"
Case &H41A: OSLanguage = "serbo_croatian_latin"
Case &H41B: OSLanguage = "slovak"
Case &H41C: OSLanguage = "albanian"
Case &H41D: OSLanguage = "swedish"
Case &H41E: OSLanguage = "thai"
Case &H41F: OSLanguage = "turkish"
Case &H420: OSLanguage = "urdu"
Case &H421: OSLanguage = "bahasa"
Case &H804: OSLanguage = "simplified_chinese"
Case &H807: OSLanguage = "swiss_german"
Case &H809: OSLanguage = "uk_english"
Case &H80A: OSLanguage = "mexican_spanish"
Case &H80C: OSLanguage = "belgian_french"
Case &H810: OSLanguage = "swiss_italian"
Case &H813: OSLanguage = "belgian_dutch"
Case &H814: OSLanguage = "norvegian_nynorsk"
Case &H816: OSLanguage = "portugese"
Case &H81A: OSLanguage = "serbo_croatian_cyrillic"
Case &HC0C: OSLanguage = "canadian_french"
Case &H100C: OSLanguage = "swiss_french"
Case Else: OSLanguage = "uk_english"
End Select
End Function
"Pascal B." <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit dans le message
de news:uSwIFrEWEHA.2928@tk2msftngp13.phx.gbl...
Bonjour à tous,
Comment puis-je connaître la langue du Windows sous lequel est installé
Select Case LanguageID Case &H401: OSLanguage = "arabic" Case &H402: OSLanguage = "bulgarian" Case &H403: OSLanguage = "catalan" Case &H404: OSLanguage = "traditional_chinese" Case &H405: OSLanguage = "czech" Case &H406: OSLanguage = "danish" Case &H407: OSLanguage = "deutsch" Case &H408: OSLanguage = "greek" Case &H409: OSLanguage = "us_english" Case &H40A: OSLanguage = "castillan_spanish" Case &H40B: OSLanguage = "finnish" Case &H40C: OSLanguage = "français" Case &H40D: OSLanguage = "hebrew" Case &H40E: OSLanguage = "hungarian" Case &H40F: OSLanguage = "icelandic" Case &H410: OSLanguage = "italian" Case &H411: OSLanguage = "japanese" Case &H412: OSLanguage = "korean" Case &H413: OSLanguage = "dutch" Case &H414: OSLanguage = "norvegian_bokmal" Case &H415: OSLanguage = "polish" Case &H416: OSLanguage = "brazilian_portugese" Case &H417: OSLanguage = "rhaeto_romanic" Case &H418: OSLanguage = "romanian" Case &H419: OSLanguage = "russian" Case &H41A: OSLanguage = "serbo_croatian_latin" Case &H41B: OSLanguage = "slovak" Case &H41C: OSLanguage = "albanian" Case &H41D: OSLanguage = "swedish" Case &H41E: OSLanguage = "thai" Case &H41F: OSLanguage = "turkish" Case &H420: OSLanguage = "urdu" Case &H421: OSLanguage = "bahasa" Case &H804: OSLanguage = "simplified_chinese" Case &H807: OSLanguage = "swiss_german" Case &H809: OSLanguage = "uk_english" Case &H80A: OSLanguage = "mexican_spanish" Case &H80C: OSLanguage = "belgian_french" Case &H810: OSLanguage = "swiss_italian" Case &H813: OSLanguage = "belgian_dutch" Case &H814: OSLanguage = "norvegian_nynorsk" Case &H816: OSLanguage = "portugese" Case &H81A: OSLanguage = "serbo_croatian_cyrillic" Case &HC0C: OSLanguage = "canadian_french" Case &H100C: OSLanguage = "swiss_french" Case Else: OSLanguage = "uk_english" End Select
End Function
"Pascal B." <pascbr{_AROBASE_}hotmail{_POINT_}com> a écrit dans le message de news:
Bonjour à tous,
Comment puis-je connaître la langue du Windows sous lequel est installé
mon programme ?
Pascal?
François Picalausa
Hello,
Il y a nettement plus simple qu'un select case pour l'affichage: Private Const LOCALE_SLANGUAGE = &H2 ' localized name of language Private Const LOCALE_SENGLANGUAGE = &H1001 ' English name of language Private Const LOCALE_SENGCOUNTRY = &H1002 ' English name of country Private Const LOCALE_SABBREVLANGNAME = &H3 ' abbreviated language name
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 Declare Function GetSystemDefaultLCID _ Lib "kernel32" _ ( _ ) _ As Long
Private Sub Command1_Click() Dim Buffer As String * 255
Buffer = "" GetLocaleInfo GetSystemDefaultLCID, _ LOCALE_SABBREVLANGNAME, Buffer, 255 MsgBox Buffer 'FRB End Sub
Il est aussi possilbe d'utiliser les fonctions GetSystemDefaultUILanguage et GetSystemDefaultLangID bien qu'elles retournent des LANGID plutôt que des LCID. Dans ce cas il faudra utiliser la macro MAKELCID: http://apisvb.europe.webmatrixhosting.net/article.aspx?articleidh
On pourra utiliser, par exemple: Private Const LOCALE_SLANGUAGE = &H2 ' localized name of language Private Const SORT_DEFAULT = &H0 ' sorting default
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 Declare Function GetSystemDefaultLangID _ Lib "kernel32" _ ( _ _ ) _ As Integer
Private Function MAKELCID(ByRef wLanguageID As Integer, ByRef wSortID As Integer) As Long MAKELCID = (wSortID * &H10000) Or (wLanguageID And &HFFFF) End Function
Private Sub Command1_Click() Dim Buffer As String * 255
'Exemple pour FR-BE
Buffer = "" GetLocaleInfo MAKELCID(GetSystemDefaultLangID, SORT_DEFAULT), _ LOCALE_SLANGUAGE, Buffer, 255 MsgBox Buffer 'Français (Belgique) End Sub
Par contre, effectivement, s'il s'agit du code, il faudra un select cas. Mais dans ce cas, un LANGID sera peut-être plus approprié. On pourra en extraire le Primary Language ID (bits 0 à 9) et le Sub Language ID (bit 10 à 15).
La table des Primary Language ID est disponible ici: http://msdn.microsoft.com/library/en-us/intl/nls_238z.asp Pour les Sub Language ID: http://msdn.microsoft.com/library/en-us/intl/nls_19ir.asp
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"Christian HUBERT-HUGOUD- Xtrem7" a écrit dans le message de news:cb9u4l$gnm$
Essaye ceci :
Function OSLanguage() As String Dim LanguageID&
LanguageID = GetSystemDefaultLangID()
Select Case LanguageID Case &H401: OSLanguage = "arabic" Case &H402: OSLanguage = "bulgarian"
Hello,
Il y a nettement plus simple qu'un select case pour l'affichage:
Private Const LOCALE_SLANGUAGE = &H2 ' localized name of language
Private Const LOCALE_SENGLANGUAGE = &H1001 ' English name of language
Private Const LOCALE_SENGCOUNTRY = &H1002 ' English name of country
Private Const LOCALE_SABBREVLANGNAME = &H3 ' abbreviated language
name
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 Declare Function GetSystemDefaultLCID _
Lib "kernel32" _
( _
) _
As Long
Private Sub Command1_Click()
Dim Buffer As String * 255
Buffer = ""
GetLocaleInfo GetSystemDefaultLCID, _
LOCALE_SABBREVLANGNAME, Buffer, 255
MsgBox Buffer 'FRB
End Sub
Il est aussi possilbe d'utiliser les fonctions GetSystemDefaultUILanguage et
GetSystemDefaultLangID bien qu'elles retournent des LANGID plutôt que des
LCID. Dans ce cas il faudra utiliser la macro MAKELCID:
http://apisvb.europe.webmatrixhosting.net/article.aspx?articleidh
On pourra utiliser, par exemple:
Private Const LOCALE_SLANGUAGE = &H2 ' localized name of language
Private Const SORT_DEFAULT = &H0 ' sorting default
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 Declare Function GetSystemDefaultLangID _
Lib "kernel32" _
( _
_
) _
As Integer
Private Function MAKELCID(ByRef wLanguageID As Integer, ByRef wSortID As
Integer) As Long
MAKELCID = (wSortID * &H10000) Or (wLanguageID And &HFFFF)
End Function
Private Sub Command1_Click()
Dim Buffer As String * 255
'Exemple pour FR-BE
Buffer = ""
GetLocaleInfo MAKELCID(GetSystemDefaultLangID, SORT_DEFAULT), _
LOCALE_SLANGUAGE, Buffer, 255
MsgBox Buffer 'Français (Belgique)
End Sub
Par contre, effectivement, s'il s'agit du code, il faudra un select cas.
Mais dans ce cas, un LANGID sera peut-être plus approprié.
On pourra en extraire le Primary Language ID (bits 0 à 9) et le Sub
Language ID (bit 10 à 15).
La table des Primary Language ID est disponible ici:
http://msdn.microsoft.com/library/en-us/intl/nls_238z.asp
Pour les Sub Language ID:
http://msdn.microsoft.com/library/en-us/intl/nls_19ir.asp
--
François Picalausa (MVP VB)
http://faq.vb.free.fr --- http://msdn.microsoft.com
http://apisvb.europe.webmatrixhosting.net
"Christian HUBERT-HUGOUD- Xtrem7" <c.hubert-hugoud@xtrem7.com> a écrit
dans le message de news:cb9u4l$gnm$1@aphrodite.grec.isp.9tel.net
Essaye ceci :
Function OSLanguage() As String
Dim LanguageID&
LanguageID = GetSystemDefaultLangID()
Select Case LanguageID
Case &H401: OSLanguage = "arabic"
Case &H402: OSLanguage = "bulgarian"
Il y a nettement plus simple qu'un select case pour l'affichage: Private Const LOCALE_SLANGUAGE = &H2 ' localized name of language Private Const LOCALE_SENGLANGUAGE = &H1001 ' English name of language Private Const LOCALE_SENGCOUNTRY = &H1002 ' English name of country Private Const LOCALE_SABBREVLANGNAME = &H3 ' abbreviated language name
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 Declare Function GetSystemDefaultLCID _ Lib "kernel32" _ ( _ ) _ As Long
Private Sub Command1_Click() Dim Buffer As String * 255
Buffer = "" GetLocaleInfo GetSystemDefaultLCID, _ LOCALE_SABBREVLANGNAME, Buffer, 255 MsgBox Buffer 'FRB End Sub
Il est aussi possilbe d'utiliser les fonctions GetSystemDefaultUILanguage et GetSystemDefaultLangID bien qu'elles retournent des LANGID plutôt que des LCID. Dans ce cas il faudra utiliser la macro MAKELCID: http://apisvb.europe.webmatrixhosting.net/article.aspx?articleidh
On pourra utiliser, par exemple: Private Const LOCALE_SLANGUAGE = &H2 ' localized name of language Private Const SORT_DEFAULT = &H0 ' sorting default
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 Declare Function GetSystemDefaultLangID _ Lib "kernel32" _ ( _ _ ) _ As Integer
Private Function MAKELCID(ByRef wLanguageID As Integer, ByRef wSortID As Integer) As Long MAKELCID = (wSortID * &H10000) Or (wLanguageID And &HFFFF) End Function
Private Sub Command1_Click() Dim Buffer As String * 255
'Exemple pour FR-BE
Buffer = "" GetLocaleInfo MAKELCID(GetSystemDefaultLangID, SORT_DEFAULT), _ LOCALE_SLANGUAGE, Buffer, 255 MsgBox Buffer 'Français (Belgique) End Sub
Par contre, effectivement, s'il s'agit du code, il faudra un select cas. Mais dans ce cas, un LANGID sera peut-être plus approprié. On pourra en extraire le Primary Language ID (bits 0 à 9) et le Sub Language ID (bit 10 à 15).
La table des Primary Language ID est disponible ici: http://msdn.microsoft.com/library/en-us/intl/nls_238z.asp Pour les Sub Language ID: http://msdn.microsoft.com/library/en-us/intl/nls_19ir.asp
-- François Picalausa (MVP VB) http://faq.vb.free.fr --- http://msdn.microsoft.com http://apisvb.europe.webmatrixhosting.net
"Christian HUBERT-HUGOUD- Xtrem7" a écrit dans le message de news:cb9u4l$gnm$
Essaye ceci :
Function OSLanguage() As String Dim LanguageID&
LanguageID = GetSystemDefaultLangID()
Select Case LanguageID Case &H401: OSLanguage = "arabic" Case &H402: OSLanguage = "bulgarian"