Solved

OPEN AN EXISTING TXT FILE IN A NEW WINDOW

Posted on 2006-07-20
1
238 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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