Solved

Reopen a textfile passed as an argument via a timer.

Posted on 1998-09-25
3
191 Views
Last Modified: 2013-11-19
I used the appwizard to create an SDI where I changed the base class of CView to CEditView.  So, a text file passed as a command-line argument will display and be editable(by default).  I have a text file that is accessed and changed from other sources on my network.  I have the timer in MainFrm set to go off every 3 secs.  I need to know how and where to close the file, so that the timer can reload it.
0
Comment
Question by:nunnbetter
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
danny_pav earned 50 total points
ID: 1322611
1.  Consider reloading every three seconds.  Aren't you going to lose any changes you make in the EditView?
2.  Consider having a refresh menu item/toolbar button that also performs the same action.
3.  How to do it:  Add a function to the Document.  Have it call its own OnOpenDocument() (again) and when it is complete use UpdateAllViews() to change the view.
0
 

Author Comment

by:nunnbetter
ID: 1322612
Well, the document will be read-only in the client area.  Strictly for viewing the file.  About the other, I am kind of confused.  Could you give me an example.  I used the class wizard to add the OnOpenDocument in the CMyDoc.  But, not sure what else to do.  Thanks.
0
 
LVL 3

Expert Comment

by:danny_pav
ID: 1322613
Get the name of the file to open--use CDocument::GetPathName
and use it as the argument to OnOpenDocument()
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 98
Expand LInux Boot partition remotly 3 102
difference between String.subString() and String.subSequence() 6 271
zeroMAx challenge 20 126
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question