|
-
Mar 25th, 2011, 11:57 AM
#1
Thread Starter
Lively Member
[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
-
Mar 27th, 2011, 12:47 AM
#2
Re: Notepad handling memory
I think it can open a lot more but it's slow. Wordpad is much faster.
-
Mar 27th, 2011, 01:30 AM
#3
Thread Starter
Lively Member
Re: Notepad handling memory
Hi,
You're entirely right regarding Wordpad speed. Thanks.
Kind regards,
JKepler
-
Mar 27th, 2011, 12:52 PM
#4
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.
-
Mar 27th, 2011, 01:07 PM
#5
Re: [RESOLVED] Notepad handling memory
 Originally Posted by jkepler
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.
-
Mar 27th, 2011, 01:10 PM
#6
Thread Starter
Lively Member
Re: [RESOLVED] Notepad handling memory
 Originally Posted by LaVolpe
Hi,
Is there a way of making that query in VB6 code? For Notepad, for instance?
Kind regards,
Jkepler
-
Mar 27th, 2011, 01:15 PM
#7
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
 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|