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

SetWindowTextW (and DefWindowProcW) doesn't work on Windows 2000?

202 views
Skip to first unread message

Gerben Abbink

unread,
Jun 22, 2008, 5:36:30 AM6/22/08
to
Hi,

I am developing a Unicode application using MSLU. I am trying to give my
application a Chinese caption without success on Windows 2000 (English
version).

Normally, a window's caption is set by calling SetWindowTextW(). But, my
application's main windows is *not* a unicode window (it is created using
CreateWindow()) so i can't use SetWindowTextW().
Searching on the internet i found this solution: call DefWindowProcW(..,
WM_SETTEXT, ...unicode string...) directly. And, yes it works, on Windows
XP. But, on Windows 2000 (Win2k) it still see only question marks "???".
Notepad has no problem displaying the same Chinese characters in Notepad's
caption.

Any ideas?
- Gerben


David Lowndes

unread,
Jun 22, 2008, 9:19:52 AM6/22/08
to

Why not bite the bullet and make your application fully Unicode with a
Unicode window?

Dave

Gerben Abbink

unread,
Jun 23, 2008, 2:34:54 AM6/23/08
to
That's not an option.

"David Lowndes" <Dav...@example.invalid> wrote in message
news:3aks54dc1drgnh703...@4ax.com...

Mihai N.

unread,
Jun 24, 2008, 1:22:33 AM6/24/08
to
> That's not an option.

I don't know whay "that's not an option", if you don't ellaborate.
But that's your problem.

What I can tell is that you will continue having bugs.
Patchy stuff, mixing Unicode with non-Unicode calls,
is a recipe for more bugs like this.
You will find a bug, spend two days figuring it out, fix one call,
somethine else will break, and so on.

This might be ok for you, and maybe you really don't have the option
of going Unicode. But at least you know what to expect.


--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

Gerben Abbink

unread,
Jun 24, 2008, 4:00:28 PM6/24/08
to
It's not an option because it's old non-unicode software and we don't have
time to port it to unicode. So, i am calling RegisterClass() and
CreateWindow() (not RegisterClassW() and CreateWindowW()), but according to
information i have found on the Internet it should still be possible to call
DefWindowProcW().

What i don't understand: calling DefWindowProcW with argument WM_SETTEXT
works under Windows XP (i get a Chinese caption on an English Windows
version), but not under Windows 2000 (i get question marks).

"Mihai N." <nmihai_y...@yahoo.com> wrote in message
news:Xns9AC7E393...@207.46.248.16...

Mihai N.

unread,
Jun 25, 2008, 5:14:14 AM6/25/08
to

> It's not an option because it's old non-unicode software and we don't have
> time to port it to unicode.

"No time" is relative.
In the long run you will waste more time chasing this kind of bugs.
It is relatively easy to convert tens of thousands of lines of code per day.
It might sound scary, but this is only if you never did it before.
This might help: http://www.mihai-nita.net/article.php?artID=tounicode


> but according to
> information i have found on the Internet it should still be possible to
> call DefWindowProcW().

Not true on XP or Vista.
I am not aware that this is true on 2000.


> What i don't understand: calling DefWindowProcW with argument WM_SETTEXT
> works under Windows XP (i get a Chinese caption on an English Windows
> version), but not under Windows 2000 (i get question marks).

Exactly. And you will have more problems like this.
Mixed calls are major pita, way more than migrating to Unicode.
You must use RegisterClassW, and you must have a
"clean Unicode message pump" (GetMessageW/DispatchMessageW)

But my promise is: fix this one, and you will find another one.

David Lowndes

unread,
Jun 25, 2008, 5:56:41 AM6/25/08
to
>It is relatively easy to convert tens of thousands of lines of code per day.

Having spent the last 6 weeks doing a Unicode conversion I have to
speak up here...

It *may* be easy to convert them!

It really depends on the application in question. I've converted some
of my own projects to Unicode in a few hours, but this project is a
dog to do - it is taken weeks and I'm only now starting to debug it.

Dave

0 new messages