Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Make vb6 app have UNICODE window text

1,176 views
Skip to first unread message

swt...@gmail.com

unread,
Feb 28, 2009, 12:04:34 AM2/28/09
to
Hello to all,
I have written a code which allows vb6 programs to have UNICODE window
text. Here is how it works:

I do this by first subclassing the window with SetWindowLongW then in
my new window procedure I trap WM_GETTEXT and WM_SETTEXT then pass
them directly to default window procedure rather than passing it to
vb6's window procedure. My concern is that vb6's window procedure is
ANSI while my new window procedure is UNICODE. I pass all the other
messages to vb6's window procedure by calling CallWindowProcA.

MSDN says "Windows NT/2000/XP: The CallWindowProc function handles
Unicode-to-ANSI conversion. You cannot take advantage of this
conversion if you call the window procedure directly." So my code
should work fine right? Will it work in Vista as well? Does anyone
think this code might have any problem? I could upload a sample if
needed for anyone.

C Kevin Provance

unread,
Feb 28, 2009, 12:14:01 AM2/28/09
to
Go ahead and post your URL to where I can download it. No TINY URLs please.
Half my network is Vista, so I'd glad to try it out for you.

- Kev

<swt...@gmail.com> wrote in message
news:bb04419d-583c-41fd...@l33g2000pri.googlegroups.com...

swt...@gmail.com

unread,
Feb 28, 2009, 6:52:25 AM2/28/09
to
On Feb 28, 10:14 am, "C Kevin Provance"

<BillMRapedMySheep@.netblows.ms> wrote:
> Go ahead and post your URL to where I can download it.  No TINY URLs please.
> Half my network is Vista, so I'd glad to try it out for you.
>
> - Kev

Thanks Kev. The file is located at http://www.savefile.com/files/2020518
.

Before you run the exe, please make sure of the following:
1. Have vb6 runtime files installed
2. Have Indic language group installed. The app will automatically
notify you if it isn't installed in your system. It will also tell you
where to install it from. If you have Vista Ultimate installed, you
shouldn't have a problem.

A screenshot in JPEG will be appreciated. Also let me know your OS
name and Edition (eg: Home Basic, Ultimate etc)

Thanks,
San

swt...@gmail.com

unread,
Feb 28, 2009, 7:01:03 AM2/28/09
to
While Kev tests the sample, could anyone else point out if there could
be any problem (such as General Protection Fault) that may occur due
to the use of code I mentioned above? Anything that may cause a
problem in future?

-San

C Kevin Provance

unread,
Feb 28, 2009, 3:45:08 PM2/28/09
to

<swt...@gmail.com> wrote in message
news:59c9dda1-37cf-4048...@p36g2000prp.googlegroups.com...

On Feb 28, 10:14 am, "C Kevin Provance"
Thanks Kev. The file is located at http://www.savefile.com/files/2020518

Well, I guess I need to clarify something. I am more than happy to assist
one with their problems, but I won't run a compiled exe from someone I don't
know (I mean no offense by this). I thought you were going to show me a
project, which I would be happy to review. If something doesn't work, a
compiled exe won't tell me anything.

- Kev


swt...@gmail.com

unread,
Feb 28, 2009, 10:14:57 PM2/28/09
to
On Mar 1, 1:45 am, "C Kevin Provance" <BillMRapedMySheep@.netblows.ms>
wrote:
> <swtb...@gmail.com> wrote in message

>
> news:59c9dda1-37cf-4048...@p36g2000prp.googlegroups.com...
> On Feb 28, 10:14 am, "C Kevin Provance"
> Thanks Kev. The file is located athttp://www.savefile.com/files/2020518

>
> Well, I guess I need to clarify something.  I am more than happy to assist
> one with their problems, but I won't run a compiled exe from someone I don't
> know (I mean no offense by this).  I thought you were going to show me a
> project, which I would be happy to review.  If something doesn't work, a
> compiled exe won't tell me anything.
>
> - Kev

I didn't send the project file because I thought VB6 IDE doesn't run
in Vista!
If you need it then here it is:
http://www.savefile.com/files/2021320

C Kevin Provance

unread,
Mar 1, 2009, 11:45:55 AM3/1/09
to

<swt...@gmail.com> wrote in message
news:a3936a70-6cd1-4249...@v1g2000prd.googlegroups.com...

I didn't send the project file because I thought VB6 IDE doesn't run
in Vista!
If you need it then here it is:
http://www.savefile.com/files/2021320

It does actually. Make sure you run the VB.exe as admin.

I'll look at this this afternoon!

- Kev


swt...@gmail.com

unread,
Mar 2, 2009, 11:00:13 PM3/2/09
to
On Mar 1, 9:45 pm, "C Kevin Provance" <BillMRapedMySheep@.netblows.ms>
wrote:
> <swtb...@gmail.com> wrote in message

How long is it gonna take?

chint

unread,
Mar 4, 2009, 4:32:52 PM3/4/09
to
How about the possibility to 'type' unicode directly to VB textbox or make a
unicode textbox ?

if you have how to then let me know

thanks a lot :)


chint

unread,
Mar 4, 2009, 4:41:14 PM3/4/09
to
Hi, i have tested your code in Vista. its working find.


Timo Kunze

unread,
Mar 5, 2009, 4:35:36 AM3/5/09
to
chint schrieb:

> How about the possibility to 'type' unicode directly to VB textbox or make a
> unicode textbox ?
Watching for a Unicode textbox?
http://www.timosoft-software.de/index.php/downloads/editcontrols/

;)
Timo
--
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
"Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
demokratischem Wege – durchsetzen."

swt...@gmail.com

unread,
Mar 5, 2009, 6:25:25 AM3/5/09
to
On Mar 5, 2:41 am, "chint" <u...@server.com> wrote:
> Hi, i have tested your code in Vista. its working find.

Thanks a lot for the test. Anyway, to know more about how to add
UNICODE to your everyday vb6 apps, look no further than http://www.unisuite.com/

swt...@gmail.com

unread,
Mar 5, 2009, 6:44:48 AM3/5/09
to
This post is specifically to Timo.

As you have had much experience in making UNICODE controls, could you
please test my code above and point flaws if any?

Thanks,
SanZB

chint

unread,
Mar 5, 2009, 8:53:02 AM3/5/09
to
Well no. I mean a VB6 textbox control or a workaround which allows me to
type (not just display) Unicode text. I tried your control and when I try to
type Unicode text it output '????'

I have played with Unicode few years back and haven't found a solution to
this problem except one from Woodbury but his control sells for 500$ + I
don't know how he did but he did.

the main problem is VB6 window is created using the ANSI function
CreateWindow not CreateWindowW so when we type a Unicode text, windows
automatically converts the Unicode text to ANSI and output becomes '???'

any workaround ?

i really need it :)

btw, i tried downloading lastest version of your controls and it gives me a
404.

Thanks Everyone.


Timo Kunze

unread,
Mar 5, 2009, 10:00:58 AM3/5/09
to
chint schrieb:

> Well no. I mean a VB6 textbox control or a workaround which allows me to
> type (not just display) Unicode text. I tried your control and when I try to
> type Unicode text it output '????'
Have you used the ANSI version by any chance? My textbox control can not
only display Unicode text.

> the main problem is VB6 window is created using the ANSI function
> CreateWindow not CreateWindowW so when we type a Unicode text, windows
> automatically converts the Unicode text to ANSI and output becomes '???'
>
> any workaround ?

This only is a problem if you use SendKeys or SendInput. I don't know a
workaround, but am looking for one, too.

> btw, i tried downloading lastest version of your controls and it gives me a
> 404.

I'll fix it, thanks.

chint

unread,
Mar 5, 2009, 10:39:48 AM3/5/09
to
Since the latest version link gave me 404, I used 1.3.2.

Tested it on Vista, was not able to test on my main XP system. On XP it gave
me a error that the control is out of date.
---------------------------
Failed to load control 'TextBox' from EditCtlsU.ocx. Your version of
EditCtlsU.ocx may be outdated. Make sure you are using the version of the
control that was provided with your application.
---------------------------

> This only is a problem if you use SendKeys or SendInput. I don't know a
> workaround, but am looking for one, too.

Don't know about SendKeys, but for me your control is not not working. and I
used IME to enter the text, it still comes out as '???' I don't think its
because of font, as if its was because of font, I would have got squares.

What I am looking for is some workaround which allow me to type Unicode text
to VB6 textbox directly. instead of using any 3rd part control.


Timo Kunze

unread,
Mar 5, 2009, 11:08:14 AM3/5/09
to
chint schrieb:

> Tested it on Vista, was not able to test on my main XP system. On XP it gave
> me a error that the control is out of date.
> ---------------------------
> Failed to load control 'TextBox' from EditCtlsU.ocx. Your version of
> EditCtlsU.ocx may be outdated. Make sure you are using the version of the
> control that was provided with your application.
> ---------------------------
The links are working now. If you have not used the installer, you need
to register the ocx file manually and you'll need administrative
privileges to do this. You've probably an old version (older than 1.2.0)
of EditCtlsU.ocx on your system. There was a break in binary
compatibility at version 1.2.0. So if you're just trying with a compiled
program and this program was compiled against the old version of
EditCtlsU.ocx, you need to either recompile against version 1.3.2 (or
1.3.3) or use this old version of EditCtlsU.ocx against which the
program was compiled.

> Don't know about SendKeys, but for me your control is not not working. and I
> used IME to enter the text, it still comes out as '???' I don't think its
> because of font, as if its was because of font, I would have got squares.

Well, what shall I say? It works for me (Vista SP1) and you're the first
one reporting that he would get question marks when typing Unicode
characters into the control. Also I don't see how this could fail. It's
probably a configuration problem with your system or with your app.

> What I am looking for is some workaround which allow me to type Unicode text
> to VB6 textbox directly. instead of using any 3rd part control.

Can't the code posted by the thread-opener not be adopted to VB6
textboxes (I have not yet looked at the code)? Behind the scenes the VB6
textbox is just a native Edit control.

chint

unread,
Mar 5, 2009, 12:51:40 PM3/5/09
to
Got it, it works but not for all languages. Earlier I only tested it with
Hindi. seems like your control cant take input in Indic languages. I tested
a few other Indic languages and they also seems to not work.

here is a screenshot.
http://img300.imageshack.us/img300/1675/40544225.jpg


"Timo Kunze" <TKunz...@gmx.de> wrote in message
news:eSaWYyan...@TK2MSFTNGP02.phx.gbl...

Thorsten Albers

unread,
Mar 6, 2009, 7:42:49 AM3/6/09
to
chint <us...@server.com> schrieb im Beitrag
<#vRMNsbn...@TK2MSFTNGP05.phx.gbl>...

> Got it, it works but not for all languages. Earlier I only tested it with

> Hindi. seems like your control cant take input in Indic languages. I
tested
> a few other Indic languages and they also seems to not work.
>
> here is a screenshot.
> http://img300.imageshack.us/img300/1675/40544225.jpg

Are you really sure that the font to which the control has been set does
support Hindi and Telugu? It looks as if the font is Vista's MS Sans Serif
which AFAIK doesn't support any indic script.

--
Thorsten Albers

albers (a) uni-freiburg.de

chint

unread,
Mar 6, 2009, 10:02:08 AM3/6/09
to
Yes, I used Arial Unicode MS. I don't think its a font issue, but I can
paste any Indic text and it displays correctly but I cant type. I tested it
on 3 system with same result XP-SP3, Vista SP1, Vista in Virtual PC. Install
Indic Language (no need in Vista) add a keyboard and try it yourself. FYI -
Hindi font in XP is Mangal.

"Thorsten Albers" <alber...@THISuni-freiburg.de> wrote in message
news:O2f9Pkln...@TK2MSFTNGP05.phx.gbl...

Thorsten Albers

unread,
Mar 6, 2009, 11:41:49 AM3/6/09
to
chint <us...@server.com> schrieb im Beitrag
<ebIPHymn...@TK2MSFTNGP04.phx.gbl>...

> Yes, I used Arial Unicode MS. I don't think its a font issue, but I can
> paste any Indic text and it displays correctly but I cant type. I tested
it
> on 3 system with same result XP-SP3, Vista SP1, Vista in Virtual PC.
Install
> Indic Language (no need in Vista) add a keyboard and try it yourself.
FYI -
> Hindi font in XP is Mangal.

Then the problem presumably is due to that you are using an IME for Hindi
and Telugu but not for Cyrillic, Japanese, etc.

chint

unread,
Mar 6, 2009, 3:52:14 PM3/6/09
to
My windows version is English US, and personally i know both English and
Hindi.

Where how i tested-
I added keyboard for few languages like Russian, Japanese, Hindi, Thai. and
tested your control using the Language Toolbar aka IME and its does not
seems to
work. then I tested VBAccelator RichEdit control which is also Unicode
richtextbox, it comes up with *same* results.

But, using the same method I can perfectly type in windows notepad.

I don't know whats the problem is, may be because Indic are fairly new
inclusion in Unicode.


swt...@gmail.com

unread,
Mar 6, 2009, 8:55:08 PM3/6/09
to
What 'chint' has encountered is definitly a problem and not any font
issue. It seems that even though Timo's control is created using
CreateWindowExW, its input is behaving as it was only accepting ANSI
characters. Using IME, I can type even Arabic characters in VB6's
native ANSI textbox without doing a thing but couldn't do the same
with Indic Scripts.

A small test shows that the problem is GetMessageA(). This ANSI
version of GetMessage() function is automatically included by vb6
application and is called in a message loop. So, whenever there is a
UNICODE character typed from keyboard, it converts to the infamous '?'
string to notify that this character cannot be shown. If you could
somehow reverse engineer your complied app to call GetMessageW()
(probably by modifying imports?), you should have no problem typing
any unicode charaters.

swt...@gmail.com

unread,
Mar 6, 2009, 8:59:46 PM3/6/09
to
(something unrealted to this discussion)

Checking imports from user32,dll by Timo's control seem to reveal that
UnregisterClassA() seems to have been called for RegisterClassExW().
Probably a leak? My copy is v1.3.0.102.

swt...@gmail.com

unread,
Mar 6, 2009, 9:24:38 PM3/6/09
to
I'm sorry. In the message one post above, not only GetMessage() but
DispatchMessage() is also the culprit.

Check this test project out http://www.savefile.com/files/2029826.
Apologies for dirty coding.

Try changing 'GetMessageA' and 'DispatchMessageA' to 'GetMessageW' and
'DispatchMessageW'. Then try using IME. Whoila!

Timo Kunze

unread,
Mar 7, 2009, 5:12:16 PM3/7/09
to
Maybe the IME editor for Hindi speaks to the control via SendInput?
SendInput is known to convert input to ANSI if the focused main window
is ANSI, regardless whether the control that receives the input is Unicode.

swt...@gmail.com

unread,
Mar 7, 2009, 10:57:28 PM3/7/09
to
On Mar 8, 3:12 am, Timo Kunze <TKunze71...@gmx.de> wrote:
> Maybe the IME editor for Hindi speaks to the control via SendInput?
> SendInput is known to convert input to ANSI if the focused main window
> is ANSI, regardless whether the control that receives the input is Unicode.
>
> Timo

Then it would defeat the purpose of using IME to input unicode
characters! If everything is converted to ANSI, how can any unicode
character be ever typed using IME?

Abhishek

unread,
Mar 8, 2009, 3:31:30 AM3/8/09
to
The problem is not IME but how VB6 Window/Form is created its created using
CreateWindowExA. and its *Windows* who converts the text to ANSI before
sending it to the ANSI Window.


chint

unread,
Mar 10, 2009, 5:52:39 PM3/10/09
to
Hi San,

what are you trying to do?

I am myself trying to make Unicode controls for VB6. Label, Frame, Button,
Checkbox, RadioButton are done.
now making textbox, listbox and combobox.

--
Chint


swt...@gmail.com

unread,
Mar 14, 2009, 2:47:45 AM3/14/09
to

So had luck with textboxes yet? For label controls, I just used
DrawTextW API on pictureboxes. What did u do for that?
Fortunately, my program yet doesn't need listboxes and comboboxes.
Unless you get ANSI apis to Wide versions, Timo's listboxes and
comboboxes controls may have the same problem, though I have not
tested this yet. Good Luck with your work.

-Sanje2v

Abhishek

unread,
Apr 16, 2009, 1:37:56 PM4/16/09
to
forgot to reply. I was able to create a Edit textbox but was having problem
with changing its font. later I lost interest on it.

btw, its that your real email ID, want to get in touch?

<swt...@gmail.com> wrote in message
news:3c28e2a8-619f-48c2...@x29g2000prf.googlegroups.com...

0 new messages