View as text file

One of the seldom used features of DC++, that’s still quite useful, is the ability to view any text file’s content, directly in DC++. You can enable it by selecting “View as text file”.

What this does is that the file is opened, DC++ creates a window for the file, and outputs the first 65536 characters. When I checked the changelog for references, the only entry for this feature was that the limit was “32k”. However, the number above is what’s in the current DC++ source code, with the Smartwin change. So, the number may be “32k” on older version of DC++; I haven’t checked.

Do note that this feature mean that DC++ is trying to open a text file, and display the content. If you select eg an audio file, you’ll get undefined results, and you’re on your own.

One Response to View as text file

  1. cologic says:

    I don’t remember how specifically DC++ sets up the text control, but that’s changed recently regardless. http://msdn2.microsoft.com/en-us/library/ms672096(d=printer).aspx states:

    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.

    Suggesting that any practically reachable limit DC++ does place on the amount of text in edit controls is due to some combination of (1) concerns about performance (try opening a giant text file in Windows Notepad, which is a thin wrapper about an edit control); (2) memory usage concerns; (3) latent desires for Win9x compatibility (seems unlikely given arnetheduck’s actions); (4) some desire to avoid attacks resulting from trivially compressible files being opened and killing DC++ (I know I pointed this out in a file downloading context some years ago, but I don’t recall whether it was ever fixed. I think it was though.), but given a general lack of evinced concern about such things I very much doubt it; (5) inertia from when DC++ definitely did run on Win9x; (6) a desire to engineer DC++ users’ behaviour to open sufficiently large text files elsewhere (not sure why, though); (7) other issues I can’t think of a the moment.

    I’m betting on (5).

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: