Solved

Reopen a textfile passed as an argument via a timer.

Posted on 1998-09-25
3
189 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change owner from userA to server Local Administrators 7 62
Hibernate methods 2 71
no14 challenge 14 67
Unix Command -- Challenging  question 7 90
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.

777 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