Ctrl+S no longer recognized
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Ctrl+S no longer recognized

  1. #1
    Join Date
    Sep 2007
    Posts
    78

    Ctrl+S no longer recognized

    Hi guys,

    As of recently my software no longer recognizes the Ctrl+S command for saving a file anymore.
    The ::Serialize part of the code is no longer reached.
    Not only that, but not even the CDocument::OnFileSave part of the code is prompted when you press Ctrl+S.

    There's nothing I can see why this wouldn't work anymore.
    The message map seems to be working fine.

    Code:
    BEGIN_MESSAGE_MAP(CDocument, CCmdTarget)
    	//{{AFX_MSG_MAP(CDocument)
    	ON_COMMAND(ID_FILE_CLOSE, OnFileClose)
    	ON_COMMAND(ID_FILE_SAVE, OnFileSave)
    	ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs)
    	//}}AFX_MSG_MAP
    END_MESSAGE_MAP()
    Does anyone have any idea what could be causing this?
    And how to fix it?

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,012

    Re: Ctrl+S no longer recognized

    Normally this works with an accelerator key. Check in the resource editor if the key is still linked to the ID_FILE_SAVE id.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  3. #3
    Join Date
    Sep 2007
    Posts
    78

    Re: Ctrl+S no longer recognized

    It's there:

    Code:
       "Q",            ID_SELECT_TOP,         VIRTKEY, ALT, NOINVERT
        "S",            ID_FILE_SAVE,           VIRTKEY, CONTROL, NOINVERT
        "S",            ID_DETERMINE_SIZE,      VIRTKEY, SHIFT, CONTROL, ALT, NOINVERT
        "V",            ID_EDIT_PASTE,          VIRTKEY, CONTROL, NOINVERT
        "V",            ID_PASTE_WHOLE, 	VIRTKEY, CONTROL, ALT, NOINVERT
    But for some reason it's not recognized.
    I do have an older version of the program where it ís recognized.
    But somewhere along the line something has changed ...

    I wish I knew what.

    Does anyone have any idea what could be causing this?

  4. #4
    Join Date
    Jan 2009
    Posts
    596

    Re: Ctrl+S no longer recognized

    Quote Originally Posted by rmirani View Post
    I do have an older version of the program where it ís recognized.
    But somewhere along the line something has changed ...
    Are you using version control? If you are then you can narrow down where this changes by checking out different versions until you find two consecutive versions where one works and one doesn't. Then look at what changed between these versions.

    And if you aren't using version control, then consider this a good reason to start using it

  5. #5
    Join Date
    Sep 2007
    Posts
    78

    Re: Ctrl+S no longer recognized

    Ok, I've figured out the cause of the problem ... but now the solution.

    Because I need to know when my mouse is leaving the screen, in CMyProgramView I'm applying SetCapture() whenever the capture is lost.

    Because of this, all instructions, including Ctrl+S now seem to be routed through my CView, causing it to be ignored for its regular use (at least, that's my guess of what's happening).

    What I'm doing now is, in CMyProgramView::OnMouseMove() i'm applying the code

    Code:
    if(this!=GetCature())SetCapture();
    So, once I apply this, what I believe to be standard operation for dealing with mouse events, events like Ctrl+S, Ctrl+O and Ctrl+N are no longer picked up in the regular manner.

    Is there any way around this?

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,069

    Re: Ctrl+S no longer recognized

    If your goal is to determine when the mouse leaves your window, perhaps TrackMouseEvent and WM_MOUSELEAVE would help.

  7. #7
    Join Date
    Sep 2007
    Posts
    78

    Re: Ctrl+S no longer recognized

    Quote Originally Posted by GCDEF View Post
    If your goal is to determine when the mouse leaves your window, perhaps TrackMouseEvent and WM_MOUSELEAVE would help.
    Ok, great!
    It's working again!

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