Results 1 to 7 of 7

Thread: [RESOLVED] Notepad handling memory

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2011
    Posts
    108

    Resolved [RESOLVED] Notepad handling memory

    Hi,

    Does anyone knows the maximum file size that notepad can handle? I can open a couple of MB. But what's the safe value without getting an error?

    Kind regards,

    JKepler

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Notepad handling memory

    I think it can open a lot more but it's slow. Wordpad is much faster.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2011
    Posts
    108

    Re: Notepad handling memory

    Hi,

    You're entirely right regarding Wordpad speed. Thanks.

    Kind regards,

    JKepler

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] Notepad handling memory

    FYI. Notepad uses a standard Edit control. This is a pre-defined window class. As such it has pre-defined limits but can be modified. In order to know what the "safe" limit is, one has to query the control to get that limit

    Oh, WordPad also uses a pre-defined window class: Rich Edit Control
    Last edited by LaVolpe; Mar 27th, 2011 at 01:00 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: [RESOLVED] Notepad handling memory

    Quote Originally Posted by jkepler View Post
    Hi,

    Does anyone knows the maximum file size that notepad can handle? I can open a couple of MB. But what's the safe value without getting an error?

    Kind regards,

    JKepler
    it was originally limited to 32kilobytes, but that limit no longer exists. There isn't really a limit.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2011
    Posts
    108

    Re: [RESOLVED] Notepad handling memory

    Quote Originally Posted by LaVolpe View Post
    FYI. Notepad uses a standard Edit control. This is a pre-defined window class. As such it has pre-defined limits but can be modified. In order to know what the "safe" limit is, one has to query the control to get that limit

    Oh, WordPad also uses a pre-defined window class: Rich Edit Control
    Hi,

    Is there a way of making that query in VB6 code? For Notepad, for instance?

    Kind regards,

    Jkepler

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] Notepad handling memory

    @Lord Orwell
    Not arguing... I'd think the limit would be about 4GB theoretically. The EM_SETLIMITTEXT message on 32bit machines is a Long value; thereby making its maximum value ~2^32. But it also may be dependent upon O/S (Win9x vs NT-based). However, MSDN docs specifically indicate you can exceed whatever limit by simply 'pasting' more code at the end of the document. System memory will most likely be in play too.

    @jkepler
    You'd have to get the hWnd of the NotePad text window, then use SendMessage API to send it a EM_GETLIMITTEXT message.

    More Details
    Quote Originally Posted by MSDN
    The EM_SETLIMITTEXT message limits only the text the user can enter. It does not affect any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control by the WM_SETTEXT message. If an application uses the WM_SETTEXT message to place more text into an edit control than is specified in the EM_SETLIMITTEXT message, the user can edit the entire contents of the edit control.

    Before EM_SETLIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters.

    Edit controls on Windows NT/2000/XP: For single-line edit controls, the text limit is either 0x7FFFFFFE bytes or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either –1 bytes or the value of the wParam parameter, whichever is smaller.

    Edit controls on Windows 95/98/Me: For single-line edit controls, the text limit is either 0x7FFE bytes or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either 0xFFFF bytes or the value of the wParam parameter, whichever is smaller.
    Looking at the MSDN documentation above, it appears the high bit of the Long value for EM_SETLIMITTEXT may be reserved which could mean the maximum limit may be ~2GB. Also, out of curiosity, I sent a new Notepad instance the message and it returned a value of -1. Though none of the above really means squat. Even if you try to open a 500+ MB file, Notepad will tell you to use another editor. Though I opened an 18MB file with no issues. Even though the Edit control's limitation may exceed the bytes being read, Notepad itself may have set restrictions on file sizes.
    Last edited by LaVolpe; Mar 27th, 2011 at 02:23 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width