다음을 통해 공유


CPropertySheet::PressButton

선택 속성 시트에서 단추를 시뮬레이션합니다.

void PressButton(
   int nButton 
);

매개 변수

  • nButton
    nButton: 식별 단추를 눌러야 합니다.이 매개 변수는 다음 값 중 하나가 될 수 있습니다.

    • PSBTN_BACK [뒤로] 단추를 선택 합니다.

    • PSBTN_NEXT [다음] 단추를 선택 합니다.

    • PSBTN_FINISH [마침] 단추를 선택 합니다.

    • PSBTN_OK 확인 단추를 선택 합니다.

    • PSBTN_APPLYNOW 적용 단추를 선택 합니다.

    • PSBTN_CANCEL 취소 단추를 선택 합니다.

    • PSBTN_HELP [도움말] 단추를 선택 합니다.

설명

참조 PSM_PRESSBUTTON Windows SDK Pressbutton 메시지에 대 한 자세한 내용은.

호출을 PressButton 전송지 않습니다는 PSN_APPLY 속성 페이지에서 알림 프레임 워크.이 알림을 보내려면 호출 CPropertyPage::OnOK.

예제

// Simulate the selection of OK and Cancel buttons when Alt+K and
// Alt+C are pressed.  CMyPropertySheet is a CPropertySheet-derived 
// class.
BOOL CMyPropertySheet::PreTranslateMessage(MSG* pMsg) 
{
   if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
   {
      BOOL altkey = GetKeyState(VK_MENU) < 0;
      if (altkey)
      {
         BOOL handled = TRUE;
         switch(toupper((int)pMsg->wParam))
         {
         case 'C':                     // for Alt+C - Cancel button
            PressButton(PSBTN_CANCEL);   // or EndDialog(IDCANCEL);
            break;

         case 'K':                     // for Alt+K - OK button
            PressButton(PSBTN_OK);      // or EndDialog(IDOK);
            break;

         default:
            handled = FALSE;
         }

         if (handled)
            return TRUE;
      }
   }

   return CPropertySheet::PreTranslateMessage(pMsg);
}

요구 사항

헤더: afxdlgs.h

참고 항목

참조

CPropertySheet 클래스

계층 구조 차트