Discussion:
Main Window Title problem
(too old to reply)
Tony Duff
2010-03-11 04:04:01 UTC
Permalink
I'm migrating my app. from single byte to Unicode. I could write the title
of the main window using SetTextW and a wchar_t string successfully when the
windows were defined as single byte. Now that I have registered and created
the windows in the app as wide, this no longer works. I only get the first
character of the string showing. In other words, the main window is now
behaving as though it expects a single byte string.

What am I doing wrong? What do I have to do specifically to get the main
window fully defined as wide and to get the window title written using a wide
string?

Thanks for your assistance,
Tony Duff
David Lowndes
2010-03-11 08:45:31 UTC
Permalink
Post by Tony Duff
I'm migrating my app. from single byte to Unicode. I could write the title
of the main window using SetTextW and a wchar_t string successfully when the
windows were defined as single byte. Now that I have registered and created
the windows in the app as wide, this no longer works. I only get the first
character of the string showing. In other words, the main window is now
behaving as though it expects a single byte string.
Which sort of implies that your registration/creation is still of a
non-Unicode window.
Post by Tony Duff
What am I doing wrong? What do I have to do specifically to get the main
window fully defined as wide and to get the window title written using a wide
string?
Nothing out of the ordinary - usually recompiling your application for
Unicode (i.e. with _UNICODE & UNICODE defined) - and fixing any errors
in the code, is all you have to do.

Dave
drjohn_online
2010-04-24 16:39:01 UTC
Permalink
Post by David Lowndes
Post by Tony Duff
I'm migrating my app. from single byte to Unicode. I could write the title
of the main window using SetTextW and a wchar_t string successfully when the
windows were defined as single byte. Now that I have registered and created
the windows in the app as wide, this no longer works. I only get the first
character of the string showing. In other words, the main window is now
behaving as though it expects a single byte string.
Which sort of implies that your registration/creation is still of a
non-Unicode window.
Post by Tony Duff
What am I doing wrong? What do I have to do specifically to get the main
window fully defined as wide and to get the window title written using a wide
string?
Nothing out of the ordinary - usually recompiling your application for
Unicode (i.e. with _UNICODE & UNICODE defined) - and fixing any errors
in the code, is all you have to do.
Dave
.
I had a similar problem (it was a dialog-based app). Here's how I got it to
work:
Call RegisterClassW
Call CreateDialogW
Call DefWindowProcW in your WndProc (otherwise I think DefWindowProcA is used)
Strangely, I could use either an ANSI or UNICODE rc file.
-John

Continue reading on narkive:
Loading...