Hi Everyone
I want to use other languages in vb6 textboxes like Arabic, Farsi and especially Urdu. I have little knowledge that it can be done by API programming but I don't know the code which can be use for different language.
For Example for USA English we can use the following CODE:-

Const Lang_EN_USA As String = "00000409"

What will be for Urdu? Please help me as soon as possible.
Thanks in advance

Dani AI

Generated

Short answer: VB6 strings are Unicode internally but most VB6 controls and the default API declarations are ANSI, so Arabic/Urdu/Farsi will be lost unless you either use Unicode-aware APIs/controls or render the text with a Unicode-capable host. was right to point at calling the Unicode APIs; offered native-language help. Below are practical, battle-tested options and a few gotchas.

  1. Keep the standard TextBox but set/get its contents with the "W" (Unicode) APIs. Example pattern (VB6):
    
    Private Declare Function SetWindowTextW Lib "user32" (ByVal hWnd As Long, ByVal lpString As Long) As Long

Dim s As String
s = "Load Unicode text here (from file/clipboard/IME)"
Call SetWindowTextW(Text1.hWnd, StrPtr(s))

Reading back requires GetWindowTextW or SendMessageW with WM_GETTEXT and a preallocated Unicode buffer.

2) Host your text in a Unicode-capable control: the WebBrowser (HTML with dir='rtl') is an easy route that gives correct shaping and RTL layout, or use a Unicode RichEdit/third‑party Unicode textbox for full editing behavior. Example (write-only rendering):
```vb
WebBrowser1.Navigate "about:blank"
WebBrowser1.Document.Open
WebBrowser1.Document.Write "<html><body dir='rtl'>" & YourUnicodeString & "</body></html>"
WebBrowser1.Document.Close

Notes and troubleshooting:

  • Do not hard-code non-ASCII text in VB6 source; the IDE is ANSI and will corrupt literal Unicode. Load strings from files saved as Unicode, from the clipboard, or from a Unicode-aware component.
  • Input still depends on the installed keyboard layout/IME for Urdu/Arabic; add the locale in Regional Settings when testing.
  • Use a font that contains Arabic glyphs and supports contextual shaping; if characters look disconnected it is a font/control shaping issue, not the string.

Further reading: Microsoft API docs for SetWindowTextW and SendMessageW, and the Windows language/locale identifier list for programmatic keyboard/layout work:

Hi Naveed; (چطوري پسر :D)
براي اينكه به راحتي از هرزباني استفاده كني بايد توابع
API
رو به صورت يونيكد فراخواني كني كه يه كم حوصله مي خواد ولي يه راه
ديگه هم استفاده از اسكريپت عربي با يه فونت مثل
هستش, كافيه كه توي فرم لودت اينو بنويسي Tahoma
TextBox.Font.Charset = 178

ولي حالا اگه واقعا آي دي زبان فاريس رو مي خواي مي توني از اين استفاده كني:
Fasi Hex = 0x29 or 0x0429
Farsi Dec = 41

Hi Naveed


I can help you, I am good at Arabic
If you want it, sent me a private message

أنا أستطيع مساعدتك، فأنا أجيد اللغة العربية
إذا أردت ذلك، أرسل لي رسالة خاصة

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.