CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2007
    Posts
    117

    Prompt "New file" procedure

    Hi,

    I currently have a program where, by either pressing Ctrl+N or by going to "File->New" in the menu a new file is prompted.
    However, there are cases in my program where I would also like the "new file" protocol to be called when a user presses a button.
    Is there some way of accomplishing this, or can the "new file" protocol only be called by the standard Ctrl+N or "File->New" calls?

    Thank you in advance.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Prompt "New file" procedure

    Code:
    AfxGetMainWnd()->SendMessage(WM_COMMAND, ID_FILE_NEW);
    More info in TN022: Standard Commands Implementation
    Victor Nijegorodov

  3. #3
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: Prompt "New file" procedure

    Nobody cares how it works as long as it works

  4. #4
    Join Date
    Sep 2007
    Posts
    117

    Re: Prompt "New file" procedure

    Quote Originally Posted by VictorN View Post
    Code:
    AfxGetMainWnd()->SendMessage(WM_COMMAND, ID_FILE_NEW);
    More info in TN022: Standard Commands Implementation
    Wauw, thank you!
    I was not aware it was possible to do that.
    That's really great!

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Prompt "New file" procedure

    You are welcome!
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured