Posted June 8, 20187 yr Visual C++ 6 maximum textbox len? (improvements?) I have a Visual C++ 6 project which will log all memory allocation of a process to textbox, here is the problem: the log text will be truncated to 5 KB (which is way to small!) Is there any way to improve maximum key length or should I log everything to a text file?
June 8, 20187 yr you will have to use "EM_SETLIMITTEXT" to expand the buffer, also pay attention to the type chars you are dealing with. but I think it's a bad idea to cum-shoot lots of text into one text control, for logging purposes you may consider using Listbox control which is also available in Visual C++ 6.00 forms editor.
June 8, 20187 yr Author Finded this: https://stackoverflow.com/questions/180853/cedit-control-maximum-length-in-characters-it-can-display?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa But it seems there is no way to circumvent 5 KB limit. The program is also slow but it has to do with other things not textbox.
June 8, 20187 yr Author SetLimitText uses EM_SETLIMITTEXT: ftp://alpha-t.ru/%D0%A1%D0%BE%D1%84%D1%82/tv-fm/bt878%20wdm%20mini-driver/btwdmdrvinstaller-src5.3.8/WinClasses/GUI/CEditBox.hpp Anyway it doesn't work!
June 8, 20187 yr Maybe use a listview control to store separate line entries (or listbox) to make something like http://www.uvviewsoft.com/logviewer/
June 9, 20187 yr If you put too much text into a single line edit control you will see your GUI is becoming laggy with time. consider using a List or a Listview, faster and easier to read and update.
June 9, 20187 yr Author 31 minutes ago, Kurapica said: If you put too much text into a single line edit control you will see your GUI is becoming laggy with time. consider using a List or a Listview, faster and easier to read and update. The code I'm using is lazy, but still the main problem remains: the only 5 KB displayed on textbox!!! wsprintf versus multiple strcat which one is faster?
June 9, 20187 yr Author Finded a solution: RICHEDIT control but now after I add it the program doesn't start any more!
June 9, 20187 yr Author 38 minutes ago, CodeExplorer said: Finded a solution: RICHEDIT control but now after I add it the program doesn't start any more! Fixed that, here is the code: CAlocLogDlg::CAlocLogDlg(CWnd* pParent /*=NULL*/) : CDialog(CAlocLogDlg::IDD, pParent) { //{{AFX_DATA_INIT(CAlocLogDlg) m_stringToSet = _T(""); //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); AfxInitRichEdit(); // init rich edit } AfxInitRichEdit(); solved the problem! Edited June 9, 20187 yr by CodeExplorer
June 9, 20187 yr Author textbox = RICHEDIT = 5KB truncated, so unfortunately didn't fix the problem! Any suggestion will be great!
June 9, 20187 yr Can you give me a snapshot of your EDIT Styles ? use Spy++ to find this control in your process, and then go to its properties. you will find a numeric value for its styles : This is a snapshot of Windows notepad EDIT control which holds too much text !
June 9, 20187 yr and if you are using MFC, check this : https://msdn.microsoft.com/library/b1533c30-7f10-4663-88d3-8b7f2c9f7024.aspx#cedit__setlimittext
June 9, 20187 yr Author 5 hours ago, Kurapica said: Can you give me a snapshot of your EDIT Styles ? They are just default Visual C++ 6 styles, tried EM_SETLIMITTEXT and SetLimitText but with no good result. Tried with a list as you suggested and it seems to work fine. You can't copy result like you can do it on editbox but well that's it!
June 9, 20187 yr For fun, try to set the edit style to the same value you see in the above image. you can copy the value of any item in the list easily, a snippet I used WCHAR buffer[1024]; ZeroMemory(&buffer,sizeof(buffer)); //Get the index of the selected item, or any item you want ! int Index = SendMessage(GetDlgItem(hWnd, IDC_LIST2),LB_GETCURSEL,NULL,NULL); //Get the text of the selected item SendMessage(GetDlgItem(hWnd, IDC_LIST2),LB_GETTEXT,(WPARAM)Index,(LPARAM)buffer); //Set the form caption SetWindowTextW(hWnd,buffer);
Create an account or sign in to comment