Page 1 of 1

VB6 unicode form

Posted: 23 Sep 2011, 16:22
by andromeda
I would really appreciate help to set the caption of the VB6 form to a unicode string under Windows XP/7

There are many people who have some ideas on how to do this, but it never seems to be permanent (if the form loses focus, gets partially covered etc the caption goes to ??????)

Many thanks

Ben

Re: VB6 unicode form

Posted: 23 Sep 2011, 23:47
by TiKu
Hi,

try this:

Code: Select all

Call DefWindowProcW(Form1.hWnd, WM_SETTEXT, 0, StrPtr(myUnicodeString))
I do not use this anywhere, but I have been told that it works very well.

Regards
TiKu

Re: VB6 unicode form

Posted: 28 Sep 2011, 09:35
by andromeda
Unfortunately that just shows ?? in the title bar

Source code in full

Option Explicit

Private Declare Function DefWindowProcW Lib "user32" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long


Private Const WM_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE
Private Const WM_SETTEXT = &HC

Private Sub Command1_Click()
Dim NewValue As String
NewValue = ChrW$(&H6B22) & ChrW$(&H8FCE)
DefWindowProcW Form1.hWnd, WM_SETTEXT, 0, StrPtr(NewValue)
End Sub