Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

OPEN AN EXISTING TXT FILE IN A NEW WINDOW

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
geomvigla
Asked:
geomvigla
1 Solution
 
lakshman_ceCommented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now