Results 1 to 20 of 20

Thread: [RESOLVED] UNICODE in Form1 Title (VB6+WinXP)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Resolved [RESOLVED] UNICODE in Form1 Title (VB6+WinXP)

    See also Discussion : UNICODE Title in VB6

    Hi.

    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).
    Attached Files Attached Files

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: UNICODE in Form1 Title (VB6+WinXP)

    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Re: UNICODE in Form1 Title (VB6+WinXP)

    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.
    Attached Images Attached Images  
    Attached Files Attached Files

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: UNICODE in Form1 Title (VB6+WinXP)

    Is this being run on XP? If so, later when I have some time & if not already resolved, I can boot down to XP & see if I can replicate the problem.

    But using the code in your zip, works fine on Vista
    Attached Images Attached Images  
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: UNICODE in Form1 Title (VB6+WinXP)

    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Re: UNICODE in Form1 Title (VB6+WinXP)

    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.
    Attached Images Attached Images  

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: UNICODE in Form1 Title (VB6+WinXP)

    See my last reply? If so, how did the test come out?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Re: UNICODE in Form1 Title (VB6+WinXP)

    >>rem out the line: TextBox1.Text = sUniText

    I removed the line. The Textbox is blank now and it displays still "???" instead
    of unicode chars in the "active title bar" of Form1.

  9. #9
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: UNICODE in Form1 Title (VB6+WinXP)

    Ok, later I"ll boot down to XP and try this too & see if I get the similar results.
    But will be much later, currently working on something else.

    In the meantime, can you try that sample code I posted in the other thread?
    Code:
    Private Declare Function DefWindowProcW Lib "user32.dll" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    
    Private Sub Command1_Click()
        Dim bUni(0 To 25) As Byte, sUniText As String ' 13 character unicode string for testing
        bUni(0) = 205: bUni(1) = 139: bUni(2) = 120: bUni(3) = 81: bUni(4) = 132: bUni(5) = 118
        bUni(6) = 251: bUni(7) = 127: bUni(8) = 209: bUni(9) = 139: bUni(10) = 2: bUni(11) = 48
        bUni(12) = 244: bUni(13) = 102: bUni(14) = 26: bUni(15) = 89: bUni(16) = 251: bUni(17) = 127
        bUni(18) = 209: bUni(19) = 139: bUni(20) = 40: bUni(21) = 87: bUni(22) = 73: bUni(23) = 108
        bUni(24) = 237: bUni(25) = 139
        sUniText = bUni()
    
        DefWindowProcW Me.hWnd, &HC, 0&, StrPtr(sUniText) ' &HC = WM_SetText
    End Sub
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  10. #10
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: UNICODE in Form1 Title (VB6+WinXP)

    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Re: UNICODE in Form1 Title (VB6+WinXP)

    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.
    Attached Images Attached Images  
    Last edited by vb.elmar; Oct 19th, 2014 at 04:18 PM.

  12. #12
    Fanatic Member DrUnicode's Avatar
    Join Date
    Mar 2008
    Location
    Natal, Brazil
    Posts
    631

    Re: UNICODE in Form1 Title (VB6+WinXP)

    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.

  13. #13
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: UNICODE in Form1 Title (VB6+WinXP)

    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.

    But it's on PlanetSourceCode and here's the link
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  14. #14
    Fanatic Member DrUnicode's Avatar
    Join Date
    Mar 2008
    Location
    Natal, Brazil
    Posts
    631

    Re: UNICODE in Form1 Title (VB6+WinXP)

    Tried the PSC demo but I get "???" in Titlebar:

    Name:  Titlebar.png
Views: 470
Size:  4.6 KB

    Looking at the screenshot of PSC demo and that is Themed, not Classic.

    Name:  PIC2008618101249100.gif
Views: 355
Size:  3.4 KB
    Last edited by DrUnicode; Oct 19th, 2014 at 08:04 PM. Reason: More info

  15. #15
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: UNICODE in Form1 Title (VB6+WinXP)

    Quote Originally Posted by DrUnicode View Post
    Tried the PSC demo but I get "???" in Titlebar:
    Well then, as not advertised. So much for doing it without subclassing/hooking, unless themed
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  16. #16

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Re: UNICODE in Form1 Title (VB6+WinXP)

    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...

    theme service
    or
    windows theme service

    -What service do I have to run?
    Attached Images Attached Images  

  17. #17
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: UNICODE in Form1 Title (VB6+WinXP)

    From control panel, open Services. Find Themes & double click on it. Change the startup type to Automatic & click the Start button.
    Attached Images Attached Images  
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  18. #18

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Re: UNICODE in Form1 Title (VB6+WinXP)

    What service do I need? In WinXP there is no service like
    'services' or 'themes'.
    Attached Images Attached Images  

  19. #19
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: UNICODE in Form1 Title (VB6+WinXP)

    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  20. #20

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Re: UNICODE in Form1 Title (VB6+WinXP)

    Thank you.
    Unfortunately the HELP-Link is no longer valid. So I had to
    find the Help-Page on archive org. Here is the link:
    Archive.org/Fix-the-Windows-XP-Theme-Problem

    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.
    Attached Files Attached Files
    Last edited by vb.elmar; Oct 20th, 2014 at 12:20 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width