Solved

OPEN AN EXISTING TXT FILE IN A NEW WINDOW

Posted on 2006-07-20
1
235 Views
Last Modified: 2012-05-05
hi experts,
I have a win32 application project . I want when I push a button to open a new window including an existing txt file.I want this window to have the default menu(which is created when we create a window application(file,state,.... ).If you can send me the code.Thank you
0
Comment
Question by:geomvigla
1 Comment
 
LVL 15

Accepted Solution

by:
lakshman_ce earned 250 total points
ID: 17145732
1. Create a MFC AppWizard(exe)/ MFC Application based project
2. In the Application Settings select Single Document

This will bring you the default menu.
3. Add a dialog and class for that dialog , say CTextReader
4. You can handle the command events for the toolbar menu that appears by default instead of new button. For example you can use the File->New menu or 'New' toolbar button.
5. Go to the classwizard for the mainframe and add a event handler for the item ID_FILE_NEW
and add the following code to  pop up the dialog on the 'New' button click
void CMainFrame::OnFileNew()
{
      // TODO: Add your command handler code here
      CTextReader *pDialog = new CTextReader();
      BOOL ret = pDialog->Create(IDD_DIALOG1,this);
    pDialog->ShowWindow(SW_SHOW);

      
}

6.Refer to this for opening existing file and showing it on the dialog
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VisualC_PLUS_PLUS_DOT_NET/Q_21911253.html
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now