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

Does SetWindowText() have a maximum

454 views
Skip to first unread message

Charlie Gibbs

unread,
Aug 31, 1995, 3:00:00 AM8/31/95
to
In article <95Aug311111...@IH.USA.Com> cr...@cistech.com
(David Crow) writes:

>Windows paints the title bar in response to a WM_NCPAINT message
>(along with the window frames, the system button, and so on). Inside
>the DefWindowProc code that handles WM_NCPAINT messages, the code
>calls GetWindowText to get the windows title string. In this call to
>GetWindowText, the size of the buffer (the third parameter) is only
>79 bytes. This limits the length of a windows title to 79 characters.

Thanks. I was afraid there was some sort of hard-coded limit like
that. Looks like it's time to scrunch my caption text.

I find it ironic that with all the concern for backward compatibility,
the concept of the 80-character-wide screen has been completely
abandoned. ANSI_FIXED_FONT doesn't quite fit a 640x480 screen either.
Sigh...

Charli...@mindlink.bc.ca
Horn if you're honky.


David Crow

unread,
Aug 31, 1995, 3:00:00 AM8/31/95
to

(Charlie Gibbs) {Charli...@mindlink.bc.ca} writes:

| Is there a maximum string length when setting a window's caption
| with SetWindowText()? I've been getting a caption truncated at
| 78 characters. At first I thought I was getting too close to the
| edges of the window, but if I resize it with the mouse I don't see
| the missing text. I use CW_USEDEFAULT in my CreateWindow() call,
| but immediately resize it with MoveWindow() prior to ShowWindow().
| (This gives me time to GetTextMetrics() so I can scale it to the
| font.) Increasing the size in MoveWindow() leaves plenty of room
| for the text, but it still gets truncated. Any ideas?

Windows paints the title bar in response to a WM_NCPAINT message (along with
the window frames, the system button, and so on). Inside the DefWindowProc
code that handles WM_NCPAINT messages, the code calls GetWindowText to get

the windowÉs title string. In this call to GetWindowText, the size of the

buffer (the third parameter) is only 79 bytes. This limits the length of a

windowÉs title to 79 characters.


0 new messages