How to make WPF header text length more than 255 characters?

Created a WPF application in VS2015. Set the window title to a string of 290 length.

Title = "123456789 223456789 323456789 423456789 523456789 623456789 723456789 823456789 923456789 133456789 233456789 333456789 433456789 533456789 633456789 733456789 833456789 933456789 143456789 243456789 343456789 443456789 543456789 643456789 743456789 843456789 943456789 153456789 253456789 ";

When the application starts, the title is truncated to 255 characters (the maximum window and the window are expanded on 2 screens).

Stretched window

  • How to increase the number of characters displayed?
  • What is the maximum allowed length of a WPF Window header?

I tried

+5
source share
1 answer

255 characters seems to be an internal limitation in the native window function DefWindowProc().

WPF native:

UnsafeNativeMethods.SetWindowText(new HandleRef(this, CriticalHandle), title);

, . WPF.

...

Win32, DefWindowProc(), - 255 .

Windows WM_NCPAINT ( , ..). DefWindowProc(), WM_NCPAINT, GetWindowText(), . GetWindowText() , -, 255 ( Windows 79 ). 255 .

+5

Source: https://habr.com/ru/post/1660496/


All Articles