Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Visual C++ 6 maximum textbox len? (improvements?)

Featured Replies

Posted

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?
 

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.

  • 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.
 

  • 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!

Maybe use a listview control to store separate line entries (or listbox) to make something like http://www.uvviewsoft.com/logviewer/

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.

  • 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?
 

  • Author

Finded a solution: RICHEDIT control
but now after I add it the program doesn't start any more!
 

  • 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 by CodeExplorer

  • Author

textbox = RICHEDIT = 5KB truncated,
so unfortunately didn't fix the problem!
Any suggestion will be great!
 

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 !

 

fg7.jpg

  • 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!
 

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.