Text Viewer
-
Hi, Looks Fine. However I cannot compile that. Could you send me a Compiled version of that? I'll include you in the Credits. (Better: Include your Contribution in the Compiled Version) email: bramvankampen@aol.com :) :) :) regards
Bram van Kampen
You should get him to add file/open functionality instead of just drag/drop. The Express Edition of C# is, however, free.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Does it allow more than 32767 lines ? It occured to me that part of of the issue could be that the op didn't want managed code, and that it would be tricker with the older MFC controls perhaps.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
All our Code is in MFC. We do not use Managed Code.
Bram van Kampen
-
You should get him to add file/open functionality instead of just drag/drop. The Express Edition of C# is, however, free.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
You should get him to add file/open functionality instead of just drag/drop
Haha, I'm done with charity for the day. Maybe you'd like to incorporate Syslog exception logging, printing functionality, syntax highlighting, layout settings, and so on?
Christian Graus wrote:
The Express Edition of C# is, however, free.
Bingo.
-
Christian Graus wrote:
Is the 32757 line limit a major issue ? Because the rest seems easy to deal with. Just don't make it read only, but write code to reject all keypresses.
Yes, it is! We have Basic Log Files, which record transactions in ASCII, and which would cover up to six years of trading. The biggest sofar contans 425,000 lines. it is not accessed very frequently, but, the concern is that we have no tool to access it which disallows modification. Notepad loads it Sofar No Problems, it Takes a Long Time, No Problem, but it facilitates modification.
Bram van Kampen
Hmmm... if I was going to read 425,000 lines of text, I expect I'd offer search throughout the entire document, but I would not present it all to the user, I'd page it, and/or show as much as I got out of a search.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hi, Does anyone know of a Text Viewer, (for basic .txt Files) which does NOT facilitate editing or Saving. :)
Bram van Kampen
less file.txt
-
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}private void textBox1\_DragDrop(object sender, DragEventArgs e) { string\[\] files = (string\[\])e.Data.GetData(DataFormats.FileDrop); StringBuilder sb = new StringBuilder(); foreach (string path in files) { if (System.IO.Directory.Exists(path)) { AppendFolder(sb, path); } else { sb.AppendLine(System.IO.File.ReadAllText(path)); } } textBox1.Text = sb.ToString(); } private void AppendFolder(StringBuilder sb, string path) { string\[\] files = System.IO.Directory.GetFiles(path); foreach (string subpath in files) { if (System.IO.Directory.Exists(subpath)) { AppendFolder(sb, subpath); } else { sb.AppendLine(System.IO.File.ReadAllText(subpath)); } } } private void textBox1\_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.Copy; } } }
}
Form1.Designer.cs:
namespace WindowsApplication1
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <
A TextBox??? Geez! That's limited to 64 KB or around that. Can't believe you didn't use a RichTextBox. Shame on you. Now you'll get featured in the Coding Horrors forum ;P
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
Hi,
Christian Graus wrote:
No, but I am sure it would take about 30 seconds to write one.
Well I thought that, until I tried. The CEdit Control turns Gray if you make it 'Read Only', and limits to 32757 lines. Try a ListBox instead, and you are limited to 32757 lines, and you have to implement the Edit\Copy Interface and Selection Interface yourself. Notepad has None of these limitations, but allows a User to Modify and save. Googeling the question results in solutions which pride themsevelves in advanced Editing features, exactly what I Do NOT want! Hence the Question. Regards, :)
Bram van Kampen
You can use a rich text control and make it read only. It can display really large text files (once you get too large it will be very slow).
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
A TextBox??? Geez! That's limited to 64 KB or around that. Can't believe you didn't use a RichTextBox. Shame on you. Now you'll get featured in the Coding Horrors forum ;P
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com linkNishant Sivakumar wrote:
That's limited to 64 KB or around that
False.
Nishant Sivakumar wrote:
Shame on you.
Shame on you for spreading misinformation. Now you'll get featured in the Replying Horrors forum ;P .
-
You should get him to add file/open functionality instead of just drag/drop. The Express Edition of C# is, however, free.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
You should get him to add file/open functionality instead of just drag/drop.
Yes, that's well spotted. However for the purpose I want to use it, I would pass the File Open info through the 'Environment', and default to an error screen, if someone just doubleclicked on it in windows explorer, they should get an eror message stating that is NOT a Stand Alone Application.
Christian Graus wrote:
The Express Edition of C# is, however, free.
When we started writing in 1995, MFC was Free. The MFC 4.2 Compiler is still our weapon of choice, and has not failed us sofar. :)
Bram van Kampen
-
less file.txt
Robert Surtees wrote:
less file.txt
???? :)
Bram van Kampen
-
Christian Graus wrote:
You should get him to add file/open functionality instead of just drag/drop.
Yes, that's well spotted. However for the purpose I want to use it, I would pass the File Open info through the 'Environment', and default to an error screen, if someone just doubleclicked on it in windows explorer, they should get an eror message stating that is NOT a Stand Alone Application.
Christian Graus wrote:
The Express Edition of C# is, however, free.
When we started writing in 1995, MFC was Free. The MFC 4.2 Compiler is still our weapon of choice, and has not failed us sofar. :)
Bram van Kampen
*grin* yes, I am just saying that the tool to compile the code he gave you, is quite free for you to download and thus make the app work as you want.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
A TextBox??? Geez! That's limited to 64 KB or around that. Can't believe you didn't use a RichTextBox. Shame on you. Now you'll get featured in the Coding Horrors forum ;P
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com linkMSDN:
Windows NT 4.0, Windows 2000, Windows 2000 Professional, Windows 2000 Server, Windows 2000 Advanced Server, Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 Platform Note: For single line text box controls, if the MaxLength property is set to 0, the maximum number of characters the user can enter is 2147483646 or an amount based on available memory, whichever is smaller. For multiline text box controls, the maximum number of characters the user can enter is 4294967295 or an amount based on available memory, whichever is smaller. Windows Millennium Edition Platform Note: For single line text box controls, if the MaxLength property is set to 0, the maximum number of characters the user can enter is 32,766 or an amount based on available memory, whichever is smaller. For multiline text box controls, the maximum number of characters the user can enter is 65,535 or an amount based on available memory, whichever is smaller.
Windows ME has a limit of 64K. For others, the limit is 4GB. Since nobody uses ME, I'd say the real limit is 4GB. :)
-
Robert Surtees wrote:
less file.txt
???? :)
Bram van Kampen
Bram van Kampen wrote:
????
It's a better version of more. Been around since the beginning of time. Wiki[^] A windows version[^]
-
You can use a rich text control and make it read only. It can display really large text files (once you get too large it will be very slow).
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com linkYes, for the number of lines he's talking about, I think a smarter solution is needed than to just put it all into a RTB.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Christian Graus wrote:
Is the 32757 line limit a major issue ? Because the rest seems easy to deal with. Just don't make it read only, but write code to reject all keypresses.
Yes, it is! We have Basic Log Files, which record transactions in ASCII, and which would cover up to six years of trading. The biggest sofar contans 425,000 lines. it is not accessed very frequently, but, the concern is that we have no tool to access it which disallows modification. Notepad loads it Sofar No Problems, it Takes a Long Time, No Problem, but it facilitates modification.
Bram van Kampen
Bram van Kampen wrote:
Notepad loads it Sofar No Problems, it Takes a Long Time
FYI, if you turn off Word Wrap, it will load faster. And I think Word Pad will load any text file instantly. Though, like you say, it facilitates modification. Perhaps you could experiment with setting the files as readonly?
-
MSDN:
Windows NT 4.0, Windows 2000, Windows 2000 Professional, Windows 2000 Server, Windows 2000 Advanced Server, Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 Platform Note: For single line text box controls, if the MaxLength property is set to 0, the maximum number of characters the user can enter is 2147483646 or an amount based on available memory, whichever is smaller. For multiline text box controls, the maximum number of characters the user can enter is 4294967295 or an amount based on available memory, whichever is smaller. Windows Millennium Edition Platform Note: For single line text box controls, if the MaxLength property is set to 0, the maximum number of characters the user can enter is 32,766 or an amount based on available memory, whichever is smaller. For multiline text box controls, the maximum number of characters the user can enter is 65,535 or an amount based on available memory, whichever is smaller.
Windows ME has a limit of 64K. For others, the limit is 4GB. Since nobody uses ME, I'd say the real limit is 4GB. :)
aspdotnetdev wrote:
Since nobody uses ME, I'd say the real limit is 4GB.
Touche! :)
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
It takes VS 2008 20 seconds to start on my machine, and at least 8 seconds to compile the most basic app....
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
and at least 8 seconds to compile the most basic app....
Really? It depends on what you call basic, but that's way too slow - on my laptop, compiling a project with ~10 files takes 2-3 seconds, max.
Regards Senthil _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro
-
Christian Graus wrote:
You should get him to add file/open functionality instead of just drag/drop.
Yes, that's well spotted. However for the purpose I want to use it, I would pass the File Open info through the 'Environment', and default to an error screen, if someone just doubleclicked on it in windows explorer, they should get an eror message stating that is NOT a Stand Alone Application.
Christian Graus wrote:
The Express Edition of C# is, however, free.
When we started writing in 1995, MFC was Free. The MFC 4.2 Compiler is still our weapon of choice, and has not failed us sofar. :)
Bram van Kampen
-
All our Code is in MFC. We do not use Managed Code.
Bram van Kampen
If you want to create an app yourself and you don't want to use managed code, just allow the user to page through the file in 32KB chunks. Create a right arrow button that will go the next 32K and a left arrow button that will go to the previous 32K. And maybe allow the user to specify how many bytes into the file to start the loading. There are more sophisticated techniques, but that shouldn't take too long to code.
-
It takes VS 2008 20 seconds to start on my machine, and at least 8 seconds to compile the most basic app....
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
It takes VS 2008 20 seconds to start on my machine
4 seconds on mine, plus 10 seconds to rebuild a 120kloc, 16 projects solution. :cool: Time to buy a new PC Christian?
If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki v3