VB6 unicode form

The place for programming-related topics.
Post Reply
andromeda
Cadet
Posts:3
Joined:16 Jun 2011, 17:59
VB6 unicode form

Post by andromeda » 23 Sep 2011, 16:22

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

User avatar
TiKu
Administrator
Administrator
Posts:832
Joined:28 Sep 2004, 21:10
Location:Unterföhring
Contact:

Re: VB6 unicode form

Post by TiKu » 23 Sep 2011, 23:47

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
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!

andromeda
Cadet
Posts:3
Joined:16 Jun 2011, 17:59

Re: VB6 unicode form

Post by andromeda » 28 Sep 2011, 09:35

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

Post Reply