multi language


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: multi language

  1. #1
    Join Date
    Jul 2005
    Posts
    87

    Question multi language

    Is there any one knowing the right way how to make vb6 controls to multi language
    I try and I try and I didnít find the right way please help me

    For example:
    In the RichTextBox I type an English, Arabic and Hebrew chars
    And then I send a cut text too a new RichTextBox and
    I get character like that (ABC ??? ??? )


    Please help me Galit

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    VB6 controls do not support multiple languages. You would be better off using .NET if you want to create multi-language applications.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jul 2005
    Posts
    87

    thank you

    If I like 2 make my RichTextBox 2 show one language how can I do that?

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Which version of Windows are you running?
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    it is indeed possible to display the text in VB6 controls.

    To do that, the right fonts must be installed, the current locale language must be changed (in the Regional and Language Options dialog, the computer needs to be restarted in some cases) and the Charset property of the Font object for that control must be set accordingly. This is the code I use:

    http://msdn.microsoft.com/library/de...nvironment.asp

    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  6. #6
    Join Date
    Jul 2005
    Posts
    87
    I tray to use this code and it didn't work i'm sorry 2 say so.

    Public szDefaultFont
    Public Const MAX_LEADBYTES = 12
    Public Const MAX_DEFAULTCHAR = 2
    Public Const MAX_PATH = 260


    Private Declare Function GetACP Lib "kernel32" () As Long
    Private Declare Function GetOEMCP Lib "kernel32" () As Long
    Private Declare Function GetUserDefaultLCID Lib "kernel32" () As Long
    Private Declare Function GetThreadLocale Lib "kernel32" () As Long
    Private Declare Function GetLastError Lib "kernel32" () 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


    Public Type CPINFO
    MaxCharSize As Long ' max length (Byte) of a char
    DefaultChar(MAX_DEFAULTCHAR) As Byte ' default character
    LeadByte(MAX_LEADBYTES) As Byte ' lead byte ranges
    End Type


    Public Type CPINFOEX
    MaxCharSize As Long ' max length (Byte) of a char
    DefaultChar(MAX_DEFAULTCHAR) As Byte ' default character
    LeadByte(MAX_LEADBYTES) As Byte ' lead byte ranges
    UnicodeDefaultChar As String
    CodePage As Long
    CodePageName(MAX_PATH) As String
    End Type


    Private Declare Function GetCPInfo Lib "kernel32" (ByVal _
    CodePage As Long, lpCPInfo As CPINFO) As Long


    Private Declare Function GetCPInfoEx Lib "kernel32" Alias "GetCPInfoExA"
    (ByVal _
    CodePage As Long, ByVal dwFlags As Long, ByRef lpCPInfoEX As
    CPINFOEX) As Long


    Public Const ANSI_CHARSET = 0
    Public Const DEFAULT_CHARSET = 1
    Public Const SYMBOL_CHARSET = 2
    Public Const SHIFTJIS_CHARSET = 128
    Public Const HANGEUL_CHARSET = 129
    Public Const HANGUL_CHARSET = 129
    Public Const GB2312_CHARSET = 134
    Public Const CHINESESIMPLIFIED_CHARSET = 134
    Public Const CHINESEBIG5_CHARSET = 136
    Public Const OEM_CHARSET = 255
    Public Const JOHAB_CHARSET = 130
    Public Const HEBREW_CHARSET = 177
    Public Const ARABIC_CHARSET = 178
    Public Const GREEK_CHARSET = 161
    Public Const TURKISH_CHARSET = 162
    Public Const VIETNAMESE_CHARSET = 163
    Public Const THAI_CHARSET = 222
    Public Const EASTEUROPE_CHARSET = 238
    Public Const RUSSIAN_CHARSET = 204


    Public Function LocalizeDialog(frmLoc As Form) As Boolean
    Dim blnResult As Boolean
    blnResult = True


    On Error Resume Next


    ' Set the Forms Default Localized Font
    SetProperFont frmLoc.Font


    ' Set each control on the forms localized font
    For Each Controls In frmLoc
    SetProperFont Controls.Font
    Select Case Err.Number
    Case 0: ' No Problem
    Case 438: ' Doesn't support this method
    Err.Clear
    Case Else:
    blnResult = blnResult And CBool(Err.Number = 0)
    Debug.Print "Failed Localizing: " & Controls.Name & " " &
    Hex(Err.Number) & vbTab & Err.Number & vbTab & Err.Description
    Err.Clear
    End Select
    Next


    LocalizeDialog = blnResult
    End Function


    Public Sub SetProperFont(obj As Object)
    With obj
    .Size = 8
    .Name = "Microsoft Sans Serif"


    Select Case GetUserDefaultLCID()
    Case &H41A '// Croatia (Croatian)
    .Charset = EASTEUROPE_CHARSET
    Case &H424 '// Slovenia (Slovenian)
    .Charset = EASTEUROPE_CHARSET
    Case &H41B '// Slovakia (Slovak)
    .Charset = EASTEUROPE_CHARSET
    Case &H418 '// Romania (Romanian)
    .Charset = EASTEUROPE_CHARSET
    Case &H40E '// Hungary (Hungarian)
    .Charset = EASTEUROPE_CHARSET
    Case &H415 '// Poland (Polish)
    .Charset = EASTEUROPE_CHARSET
    Case &H405 '// Czechoslovakia
    .Charset = EASTEUROPE_CHARSET
    Case &H42A '// Vietnam (Vietnamese)
    .Charset = VIETNAMESE_CHARSET
    Case &H41F '// Turkey (Turkish)
    .Charset = TURKISH_CHARSET
    Case &H408 '// Greek (Greece)
    .Charset = GREEK_CHARSET
    Case &H41E '// Thailand (Tha)
    .Charset = THAI_CHARSET
    Case &H419 '// Russia (Russian)
    .Charset = EASTEUROPE_CHARSET
    Case &H419 '// Russia (Russian)
    .Charset = RUSSIAN_CHARSET
    Case &H401 ' Saudi Arabia (Arabic)
    .Charset = ARABIC_CHARSET
    Case &H40D ' Israel (Hebrew)
    .Charset = HEBREW_CHARSET
    Case &H804 ' Simplified Chinese (People's Republic of China)
    .Charset = CHINESESIMPLIFIED_CHARSET
    .Name = ChrW(&H5B8B) + ChrW(&H4F53)
    .Size = 9
    Case &H404 ' Traditional Chinese (Taiwan)
    .Charset = CHINESEBIG5_CHARSET
    .Name = ChrW(&H65B0) + ChrW(&H7D30) + ChrW(&H660E) +
    ChrW(&H9AD4) 'New Ming-Li
    .Size = 9
    Case &H411 ' Japan
    .Charset = SHIFTJIS_CHARSET
    .Name = ChrW(&HFF2D) + ChrW(&HFF33) + ChrW(&H20) +
    ChrW(&HFF30) + ChrW(&H30B4) + ChrW(&H30B7) + ChrW(&H30C3) + ChrW(&H30AF)
    .Size = 9
    Case &H412 ' Korea
    .Charset = HANGEUL_CHARSET
    .Name = ChrW(&HAD74) + ChrW(&HB9BC)
    .Size = 9
    Case Else ' Default Character Sets
    .Charset = DEFAULT_CHARSET
    End Select


    Exit Sub
    End With
    End Sub

    NOT WORKING!!

    im working in All windows Ver
    go to start--> setting-->Control Panel -->Regional and Language
    and play there :-(

  7. #7
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    it works fien with me (my code, I did not test yours...) at least in Japanese, Chinese and other non-ansii Europen languages.
    I am using XP, where I installed the fonts for the languages above noted. After I switch local from the Regional and Language Settings, all controls in my forms are ok (I use vb standard controls, plus few others like flexGrid, listView and treeView). I had few problems with a third party components, but I found a workaround.
    Which problems do you have? Did you debug your code to see if there are any errors?
    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  8. #8
    Join Date
    Jul 2005
    Posts
    87

    it's the same code

    u say thet u change the Regional Settings maybe u need 2 restart your programs then u c the bug . or u need to select different Font script in your controls
    I like 2 show u the bug i think that u are the best
    tray it more
    if u like i can Email u the test program i make

    thank you

    can u help me with this
    I am trying to replace the right (CTRL + SHIFT) keyboard action in the RichTextBox that changes the reading order form LTR to RTL by code.
    if u did it please help me i can't find the code anywhere

    thank you : - )
    Last edited by imosha; 08-11-2005 at 02:19 PM.

Similar Threads

  1. learning c# very confusing.
    By Mike Tsakiris in forum .NET
    Replies: 11
    Last Post: 10-04-2002, 05:32 PM
  2. Replies: 10
    Last Post: 03-11-2002, 05:41 PM
  3. Replies: 5
    Last Post: 02-22-2002, 11:01 AM
  4. Enough Language Bigotry!
    By Nollen in forum .NET
    Replies: 94
    Last Post: 02-23-2001, 11:44 AM
  5. Replies: 8
    Last Post: 02-12-2001, 12:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center