??????????? ????? ?? ??? ????? ???? ?? ????? C++ ??? ????? ????? ?? ????? ???? ????

???? ?????? ???? ??????
???? ID: 100770 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

??????

?? ????????? ?? ??? ??? ????? ????????? ????? ???? ????? ????? ?? ????? ????? ?? ????? ?? ????? ???? ???? ????????? ?? ????? ????? ??? ?? ????? ???? ?? ?? ????? ?? ???? ??? ??????????, ???? ?????? ??? ?? ?? ?? ???? ??? ?? ???????? ??????????? ?????? ??? ?? ???? ?? MFC ????????? ??????? ????? ?????-?????? ????????? ??? ???? ?? ???????? accelerators ????? ?? ??? ?????? ????? ?? ????? ???? ???

???? ???????

?? ????? C++ ?? Microsoft Windows ?????????? ????????? ??? (SDK) ?? ????? ?? Microsoft Windows ???????? ?????? ?? ??? ?????? ???? ?? ?? ???????? accelerators ??? ????? ???? ?? ?? ???? ??????? ?????????TranslateAccelerator()???? ????? ????? ??? ??? ???????? ??? ??, ?? ?? ???? ????? ????? ??? ??? ????? ????? ?? ??? ??? ????? ?? ??, ????????? ???? ?? ??? ????? ?? ????? ???; ???? ????, ????????? ????? ????? ????? ??????? ????? ??? (Windows ??? ?????) ?? ?????? ???? ?? ????? ?????? ??????, ?? ?? ????? ??? accelerators ????????? ???? ?? ??? ??????? ???? ???? ??? ??, ??????? ??? ???? ???TranslateAccelerator()?????? ?? ??? ???? ???..

MFC ??? ?? ???? ????? ????? ??? ??????????? ????? ?? ??????? ???? ?? ??? ?? ??????? ???? ????CWinApp::ProcessMessageFilter()?????? ?? ??? ???? ???.. ????? ???ProcessMessageFilter()before ?? ????? ??????? ???? ???

??????????? ????? ?? ??? ?? ??????? ???? ?? ??? ????? C++ .NET ??? MFC ????????? ??????? ????? ?????-?????? ????????? ?????? ???? ?? ??????? ???? ?? ??? ????? ????? ?? ???? ????:
  1. Visual Studio .NET, ??? ?? ??? MFC ????????? ?????? ???? ??? ??? MFC ????????? ??????? ??, ????? ????????????? ?? ??????, ?? ???? ??? ????????? ???? ?? ??????????? ?? ?????????? ?? ??? ??? ???????? ?????.
  2. ?????? ?????, ????? ?????? ?????? ?? ????? ?? ??? ????? ?????? ?? ???-????? ????? ????? ?????? ?? ?????? ID IDD_ ?? ???? ???? ??MYPROJECT_DIALOG (????MYPROJECT??? ?? ?????? ???? ?? ?? ??? ????????? ?? ???? ????????? ?? ???? ???)?
  3. ????? ?????? ???? ????? ?????? ?????? ???, ?? ??? ??? ????? ?? ?????? ?????? ????? ????? ?? ??????? ????????????? ?? ????????? ????????????? ????? ?? ??? ?????? ??? ???? ?? ????? ????? ?? ??? ?????? ???
  4. ??? ??? ???? ?????? ?? ?????? ?? ????-?????? ????????? ??? & ????? ?? ???? ???? ???? ??? & Exit\tCTRL + E ????? (CTRL + X ????? ?? ??????? ?? cutting ???, ????? CTRL + E ???? ????? ?? ????? ???? ???? ??)?
  5. ???? ?????? ??? ?? ???? ?? ?????exit???? ????? ??? ????? ???, ????????? ???? ?? ??ID?? ??? ???exit???? ???? ?? ??? ??? ??ID_FILE_EXIT.
  6. ?? ???? ??? ????? ?? ?????? ???? ID ???? ?? ????? ????? ?? ??? ?????? ???????? ??.???? ????? ?????? ?? ??? ????? ?????? ?? ????? ?? ?????????? ??.??? ??? ????? ??? ??? ??? 4 ??? ???? ?? ??? ???? ?? ?????? ID ?? ??? ??? ??? ????? ??? ???? ?? ???, ?????-???? ???? ??? ????? ????.???? ??.??? ??????, ?? ???? ??? ?? ???? ??? ???? ?? ??? ?????? ID ?? ??? ???? ?? ????
  7. ???? ?????? ??? ???? ?????& Exit\tCTRL + E?? ????-????? ????, ?? ???? ???????? ?????? ??????.
  8. ????? ?????? ??????? ??? ?? ??? ????????????? ??????? ????????????? ???, ?? ??? ????CDialog??? ??????? ???? ?? ??? ?????? ?? ??? ????? ???? ??? ???? ????????? ???? ?? ?????? ?????? ??? ??????? ??, ?? ???? ??? ????? ?????????? ?? ?????????? ???? ????? ?????? ??????
  9. ?????? ??? ????? ?????? ???????? ????exit???? ???? ????? ?????? ???? ?? ??? 8 ??? ?? ????? ???? ??? ??:
    PostMessage(WM_COMMAND, IDOK, 0L);
    					
    ?? ?? ?? ?????? ?? ????? ?? ?? ??? ??? ???? ??OK?? ?????????? ?????? ?????exit????? ???????????? ??.. ????? ???? ??OK???? ????? ????? ????????? ?? ??? ???? ???

  10. ??? ??? ??????????? ?????? ?? CTRL + E ????? ?????? ?? ?? ??? ?????? ?????ID_FILE_EXIT. ???? ???????? ???????
  11. ????? ??????? ?? ?? ??? ????? ???? ?? ??? Stdafx.h ????? ?? ??????? ????# ????? ???????:
    extern HWND    ghDlg;          // Handle to main dialog box.
    extern HACCEL  ghAccelTable;   // Handle to accelerator table.
    					
  12. ?????? .cpp ????? ???CWinApp??????????? derived ???? (????? ?? .cpp ??? ???? ????? ?? ?? ???? ?? ??? ??? ???? ????????? ?? ???), ?? ????? ??????? ?? initializations ??????:
    HWND    ghDlg = 0;          // Handle to main dialog box.
    HACCEL  ghAccelTable = 0;   // Handle to accelerator table.
    					
  13. ?????? ???CDialogderived ???? (???? ????? ???? ?? ??????? ???? ???? ???? ???? ???????? ?????), ??????OnInitDialog()?????? ??? ??? ?????? ??, ?? ??? ???? ??? ?? ??? ??? ???????OnInitDialog()?????? ??? ??? ???? ?? ???, ????? ?? ??? ???? ?? ???CDialog???? ????? ?????, ?? ???? ??? ??? derived ??????????? ???? ????? ????? ???? ??????OnInitDialogrow ?? ???? ????? ????? ????? ???OnInitDialog()???? overridden ?? ???? ?? ??? ???? ??? ??? ??????? ????? ?? ??? ???????
  14. ???? ??? ?? ????? ?????? ?? ????? ???? ?? ??? ???? ????? ????? ??????? ????:
    ghDlg = m_hWnd;
    					
  15. ?????? .cpp ????? ???CWinApp???????????, ??? ??????InitInstance()?????? ??????? ??? ???? ?? ??? ???? ???? ?? ????? ??? ????? ?????? ?? ??????CWinApp::InitInstance():
    ghAccelTable = LoadAccelerators(AfxGetInstanceHandle(),
    MAKEINTRESOURCE(IDR_ACCELERATOR1));
    					
    ???:: ???? ????? ???? ???? ?? ?????? ID (IDR_ACCELERATOR1) ??? ????? ??? ?? ?? ??????????? ?????? ?????? ?? ID ?? ??? ??? 10?

  16. ??? ??????? ???? ?? ??? ??????CWinApp?? ??? ???? ???ProcessMessageFilter()?????? ??????? ??? ???? ?? ???, ???? ????? ????? ???, ??? ????CWinApp???? ????????? ??? derived ????? ??, ??? ????? ??? ????? ??????????? ???? ??. ??????ProcessMessageFilter?? ?????? ?? ????-??????? ????? ?? ??? ???? ?? ??? ????? ??? ?????? ??? ?????-???? ??? ?? ????? ????, ?? ???? ??? ?? ??? ??? ??????? ????? ?? ??? ?????? ????? ????ProcessMessageFilter?????? ???
  17. ??????? ????ProcessMessageFilter()???? ?? ????? ????? ??????????? ??????? ????:
    BOOL CMyProjectApp::ProcessMessageFilter(int code, LPMSG lpMsg)
           {
              if (code < 0)
                 CWinApp::ProcessMessageFilter(code, lpMsg);
    
              if (ghDlg && ghAccelTable)
                 {
                 if (::TranslateAccelerator(ghDlg, ghAccelTable, lpMsg))
                    return(TRUE);
                 }
    
             return CWinApp::ProcessMessageFilter(code, lpMsg);
          }
    					
  18. ?????? ????, ?? ????????? ?????? ????? ??? ?? ?? ???? ???? ??? ??? ?? ?? ????? ????exit????? ???????????? ?? CTRL + E ?????, ????????? ???, ?? ??? ??? ?????????

???

???? ID: 100770 - ????? ???????: 02 ?????? 2010 - ??????: 4.0
???? ???? ???? ??:
  • Microsoft Foundation Class Library 4.2, ?? ???? ??? ?????? ???? ???:
    • Microsoft Visual C++ 2.1
    • Microsoft Visual C++ 4.0 Standard Edition
    • Microsoft Visual C# .NET 2002 Standard Edition
??????: 
kbacceleratorkey kbhowto kbkeyaccel kbmenu kbui kbmt KB100770 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:100770

??????????? ???

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com