We help IT Professionals succeed at work.

Form Captions with Unicode characters in VB6

ToFri asked
Last Modified: 2013-12-26
I want to display Unicode characters in a VB6 Form caption.
All attempts with SetWindowsTextW are failing and the string gets converted to ANSI.

Any code snippets available anywhere?

Watch Question


Thank you,

Nice, but not really a solution for the problem.
I need to show arbitrary Unicode in the caption under every Windows locale setting.

We have customers all over the world using different Windows XP versions, like Russion, Greek, Hebrew, Arabic and so on. And I just want to call SetWindowTextW.

I know (think I know) this does not work because the VB6 Form is not a Unicode-Window and so a conversion from Unicode to ANSI takes place behind the scenes.
I read somewhere, that one needs to install a hook (CBT?) and send the SetWindowTextW from inside the Hook in order to achieve the desired result&

Some code snippets for that would be very apprechiated.

Thank You anyway

Dana SeamanDana Seaman (danaseaman)

Vb Command button has a hWnd so you can use HCBT_ACTIVATE and SetWindowTextW however Vb Label does not (class is "ThunderFormDC") so you cannot hook it.

Here is a Unilabel control that works but requires that the Unicode caption be set at run-time:


To do this correctly though you need at least the following:
   1. Render Unicode using API DrawTextW
   2. Implement AutoSize using GetTextExtentPoint32W so that it gets correct metrics for Unicode strings.
   3. Vb IDE Properties window does not support Unicode strings. You can cheat by pasting UTF-8 here and converting it inside your control to UTF-16, otherwise to do it right you need a Property Page with a Unicode aware TextBox to input the Unicode caption.
   4. Modify PropertyBag persiststance of caption to use a byte array so that it does not automatically change the caption to ANSI when writing.


Yes Thank you !
I understand this works for controls inside the Form.
My question is regarding the Form Caption!
Not regarding any control inside. We did solve these problems already.
The "only" problem remaining is the Title of the application Window itself.
I mean the text between the Icon of the application and the Minimize, Restore, Close boxes.

Thank you anyway

Dana Seaman (danaseaman)
Unlock this solution and get a sample of our free trial.
(No credit card required)


Thank you very much.
This will help.
I did not think of this obvious way.
Good to have some sourcecode to start with.

Forced accept.

EE Admin

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.