Print Page | Close Window

Unicode text in Form Captions?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=10627
Printed Date: 16 November 2024 at 11:51am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Unicode text in Form Captions?
Posted By: dbenito
Subject: Unicode text in Form Captions?
Date Posted: 14 May 2008 at 6:29pm
I wasn't sure where to post this question, so I figured the best place was in the general SuitePro forum.
 
I'm evaluating v12 of the ActiveX Suite Pro, and the only question I have before I decide to buy it is this: is there any way I can set the caption of a VB6 form to a Unicode string?
 
My app has the UI translated into several languages (which the user can change at runtime), but in the past we had run into the problem of not being able to display text that wasn't in the system's default ANSI codepage. So I was basically stuck with translating the UI into Western languages.
 
When I discovered that Suite Pro came with Unicoede versions of the controls, I was extremely happy. However, I still have the problem of setting form captions to Unicode strings, and none of the controls in the suite seem to handle this. I came across a product called UniToolbox which does this, but unfortunately it doesn't work too well with the themed title bar used by the RibbonBar (the caption shows extra characters, as if WM_GETTEXT was returning extra rubbish).
 
Any ideas? If I could get this sorted out, I'd be the happiest developer in the world!
 
PS. Congrats to CodeJock on an amazing product (and in particular on the controls added between v11.2 and v12).



Replies:
Posted By: ijwelch
Date Posted: 14 May 2008 at 8:43pm
This topic may help:
https://forum.codejock.com/forum_posts.asp?TID=2542 - https://forum.codejock.com/forum_posts.asp?TID=2542

See my post 12th May for code.


Posted By: dbenito
Date Posted: 14 May 2008 at 9:24pm
I had already seen your post, but your solution only seems to work for MDI child forms - I've tried it on normal forms and MDI parents and it doesn't seem to do anything (all I get are the usual ???s).
 
After posting my message I played around some more with the UniToolbox controls, and adding an extra null character at the end solved the problem with the themed caption for the RibbonBar, so I'm that much closer.
 
Judging from how UniToolbox's UniCaption control appears to work even when the RibbonBar does its own custom painting, I'm wondering what they're doing behind the scenes. For a normal form, I would imagine that subclassing the form and calling DefWindowProcW for the various messages involved (WM_NCPAINT, WM_NCACTIVATE and WM_SETTEXT) might do the trick, but I don't know how they manage not to interfere with the custom drawing that the CJ control does - maybe it's just a matter of handling WM_GETTEXT too?
 
I'll be working on this tomorrow, so as soon as I work it out I'll let you guys now.


Posted By: dbenito
Date Posted: 15 May 2008 at 3:05pm
Confirmed!
 
Calling DefWindowProcW with WM_SETTEXT is only part of the trick - you need to subclass the window to redirect WM_NCPAINT to DefWindowProcW too (to prevent VB from calling DefWindowProcA).
 
Now I need to try this with the themed RibbonBar...
 
Edit: Getting this to work with the RibbonBar is simply a question of processing WM_GETTEXT and WM_GETTEXTLENGTH.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net