Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CWinApp::OnFileNew

CWinApp::OnFileNew

Scheduled Pinned Locked Moved C / C++ / MFC
career
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leyu
    wrote on last edited by
    #1

    Is there any way to call the CWinApp::OnFileNew except from cliking on the menu item with the default ID_FILE_NEW ; Because Of the fact the CWinApp::OnFileNew is a protected member function of CWinApp i Couldn't call AfxGetApp()->OnFileNew() Then I tried ON_REGISTERED_MESSAGE(MY_REGISTERED_MESSAGE,CWinApp::OnFileNew) and i posted the message from my CView function but didn't work as i expected. So maybe i was thinking I could fake the effect of cliking on the the menu or pressing the accelerator combination so that i can have the result something like you know FireCommand(ID_FILE_NEW); then the handler of CWinApp ON_COMMAND(ID_FILE_NEW,CWinApp::OnFileNew) does the required job Is there any way to get around this :confused::confused::confused::confused:

    J R 2 Replies Last reply
    0
    • L Leyu

      Is there any way to call the CWinApp::OnFileNew except from cliking on the menu item with the default ID_FILE_NEW ; Because Of the fact the CWinApp::OnFileNew is a protected member function of CWinApp i Couldn't call AfxGetApp()->OnFileNew() Then I tried ON_REGISTERED_MESSAGE(MY_REGISTERED_MESSAGE,CWinApp::OnFileNew) and i posted the message from my CView function but didn't work as i expected. So maybe i was thinking I could fake the effect of cliking on the the menu or pressing the accelerator combination so that i can have the result something like you know FireCommand(ID_FILE_NEW); then the handler of CWinApp ON_COMMAND(ID_FILE_NEW,CWinApp::OnFileNew) does the required job Is there any way to get around this :confused::confused::confused::confused:

      J Offline
      J Offline
      Jack Puppy
      wrote on last edited by
      #2

      How To Create New Documents Without CWinApp::OnFileNew Same idea applies to an SDI app.

      :cool: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!

      1 Reply Last reply
      0
      • L Leyu

        Is there any way to call the CWinApp::OnFileNew except from cliking on the menu item with the default ID_FILE_NEW ; Because Of the fact the CWinApp::OnFileNew is a protected member function of CWinApp i Couldn't call AfxGetApp()->OnFileNew() Then I tried ON_REGISTERED_MESSAGE(MY_REGISTERED_MESSAGE,CWinApp::OnFileNew) and i posted the message from my CView function but didn't work as i expected. So maybe i was thinking I could fake the effect of cliking on the the menu or pressing the accelerator combination so that i can have the result something like you know FireCommand(ID_FILE_NEW); then the handler of CWinApp ON_COMMAND(ID_FILE_NEW,CWinApp::OnFileNew) does the required job Is there any way to get around this :confused::confused::confused::confused:

        R Offline
        R Offline
        Ryan Binns
        wrote on last edited by
        #3

        Get a pointer to your document template, and call OpenDocumentFile(NULL) on it. This will create a new document.

        Ryan

        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups