more then 256 characters in a static text?

I need to put more then 256 characters in a static text. I allways have this error:
  warning RC4206 : title string too long; truncated at 256
I allread searched on google but found only http://cboard.cprogramming.com/archive/index.php/t-18510 , which is the same question without an answer...
pisselouAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
You can always use

SetWindowText(hWndStatic,pszStringThatisWayLongerThan256Bytes);

at runtime.
jkrCommented:
BTW, as an alternative to a static control, why not using a multiline edit control that is set to read onyl?
pisselouAuthor Commented:
I tried SetDlgItemText which was allso limited to 256 characters, so I suppose(d) that SetWindowText would have the same limitations...

I'll try it.

thanks, I'll post if it worked tomorrow (It's late here...).
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

pisselouAuthor Commented:
I tried SetWindowText, but can only give it one argument. When I use it then with only a string, it just sets the caption of the window to the text I setted in the SetWindowText.
jkrCommented:
>> I tried SetWindowText, but can only give it one argument

Are you using MFC? Then, try

::SetWindowText(hWndStatic,pszStringThatisWayLongerThan256Bytes);

to make clear that you are not referring to the CWnd member with the same name. Or, if so and the CStatic is a member of your class, call

m_myStatic.SetWindowText(pszStringThatisWayLongerThan256Bytes);
Jaime OlivaresSoftware ArchitectCommented:
This error is related to a string define at resource file, but you can use SetWindowText to set larger strings. By example, you can store a 20 page text into a text file, read it, and store entirely in a control using SetWindowText. As an alternative you can use CEdit control with read-only attribute.
pisselouAuthor Commented:
jaime_olivares,

I found on msdn: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setwindowtext.asp
but how should you read in the text so that it can be used with SetWindowText ?


thanks

Jaime OlivaresSoftware ArchitectCommented:
To read from file using MFC code:
CFile file;
if (file.Open("yourfilenamehere.txt", CFile::modeRead) {   // open successful
      int size = file.GetLength();
      buffer = new char[size+1]
      file.Read(buffer, size);  // asumming file is less than 64K long, use ReadHuge if not
      buffer[size] = 0;  // appending trailing null character
      yourcontrol.SetWindowText(buffer);
      delete buffer;
      file.Close();
}


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pisselouAuthor Commented:
thanks a lot, jaime_olivares.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.