Prompt "New file" procedure
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Prompt "New file" procedure

  1. #1
    Join Date
    Sep 2007
    Posts
    78

    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
    Wallisellen (ZH), Switzerland
    Posts
    17,277

    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,590

    Re: Prompt "New file" procedure

    Nobody cares how it works as long as it works

  4. #4
    Join Date
    Sep 2007
    Posts
    78

    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
    Wallisellen (ZH), Switzerland
    Posts
    17,277

    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center