My OS is Windows-XP. If I run IE and load the japanese website http://live.nicovideo.jp/recent
and moving the mouse cursor to the IE title bar
my VB6 project (see attachement 2,7kB) shows japanese chars
in the (forms 2.0)TextBox control on Form1.
-But it's not possible to populate
the Form1.Caption with japanese characters
The Form1 titlebar only shows "???" instead of the
japanese UNICODE characters.
-How can I show Unicode chars in a titlebar of a VB6 Form?
Annotation:
Please run my project and load the japanese website http://live.nicovideo.jp/recent
-If you move the mouse cursor to the IE browser's title bar,
you'll see japanese chars in the (forms 2.0)TextBox (TextBox1).
Strings from VB control properties will be ANSI. Suggest the following changes
Code:
Private Sub Timer1_Timer()
Static hw As Long
Dim sUniText As String
GetCursorPos pt
hw = WindowFromPoint(pt.X, pt.Y)
sUniText = Module1.gWTx(hw)
TextBox1.Text = sUniText
' either use this line & then you can completely remove the UniCaption function
DefWindowProcW Me.hWnd, WM_SETTEXT, 0&, ByVal StrPtr(sUniText)
' or use this line instead of the one above
UniCaption(Form1) = sUniText
End Sub
FYI: Regarding my insistence that you start your own thread (from previous thread) is that people may have subscribed to that thread. Each time a new post is added, emails may be sent to those that subscribed. We shouldn't be posting on other's threads for our own questions/problems.
Edited: Does that Forms2.0 textbox have a UnicodeText property (or something similar)? If so, that is property you wanted to return vs the .Text property. The fix above should work regardless
Last edited by LaVolpe; Oct 19th, 2014 at 12:04 PM.
Insomnia is just a byproduct of, "It can't be done"
I used your sample and modified my project
(the project is now: 6c.zip). The VB6 Form
titlebar is still unable to show UNICODE chars.
-Instead of UNICODE chars "???" are displayed.
I don't have Forms2.0 on my machine. So I can't test what I'm about to suggest.
Can you rem out the line: TextBox1.Text = sUniText
Now try your project again, does the titlebar display the text correctly? If so, then TextBox is modifying sUniText and the immediate fix would be to swap the order: set the titlebar first, then the TextBox
Last edited by LaVolpe; Oct 19th, 2014 at 01:20 PM.
Insomnia is just a byproduct of, "It can't be done"
Yes WinXP. I also went to "Display Properties"/Advanced/Advanced Appearance/Item:[Active Title Bar]
and set the Font to different unicode fonts like "Trebuchet MS"
but it displays still "???" instead of unicode chars.
Here's an idea. If other languages are displaying in the titlebar ok? Then may you don't have 'far eastern' language support installed. Does this link apply?
Insomnia is just a byproduct of, "It can't be done"
I tried your "unicode char generator" and it shows "?????????????" (=13chars)
instead of some unicode chars.
>> If other languages are displaying in the titlebar ok? Then may you don't have 'far eastern' language support
My Windows-XP desktop is able to have desktop textfiles which are named with
japanese characters (see "note 5" in the picture)
I have installed german and japanese.
When I save a word document with a japanese .doc name the
japanese chars are shown in the titlebar of Winword.exe.
This means winword is able to have unicode chars in the title but
my compiled VB6 projects seem to be unable to have unicode chars in title.
Last edited by vb.elmar; Oct 19th, 2014 at 04:18 PM.
According to your screenshot you are using Classic Theme (Gradient/pre-XP style).
DefWindowProcW only works if Themes are enabled.
The solution for Classic is to subclass and owner-draw your Titlebar.
The easiest fix is to just turn on Themes.
Without themes, there is a hack out there that swaps the form's window procedure with unicode one, sets the title, then restores the original window procedure. Sounds really interesting; don't know if it works or not. Maybe I'll even play with it in the next week or so; just out of curiosity.
I tried the Planetsourcecode hack. It did not work without themes. So
I tried to install Luna.theme but installation failed. A MsgBox appeared
"The theme service must be running"
... I started services.msc (Start/Run...) but there is no service like...
To fix the problem with the missing Themes I had to run a *.reg file (restorethemes.reg)
-See attachement (renum restorethemes.txt to restorethemes.reg and run it).
Then you must restart Windows-XP. After a system restart I run services.msc
and I saw the (previously missed) service named "Themes".
I installed the "Windows XP" Theme (under "Display Properties").
All my windows are with rounded edges now and when running your
"UNICODE char generator" (see posting #9) I see the
UNICODE chars in the title of my VB6 Project.
It worked. Thanks for your help.
Last edited by vb.elmar; Oct 20th, 2014 at 12:20 PM.