Compartir a través de


CPropertySheet::PressButton

Simula la elección del botón especificado en una hoja de propiedades.

void PressButton(
   int nButton 
);

Parámetros

  • nButton
    nButton: Identifica que se presione el botón.Este parámetro puede tener uno de los siguientes valores:

    • PSBTN_BACK elija el botón atrás.

    • PSBTN_NEXT elija el botón siguiente.

    • PSBTN_FINISH elija el botón de final.

    • PSBTN_OK elija el botón ACEPTAR.

    • PSBTN_APPLYNOW elija el botón de Menú de aplicar.

    • PSBTN_CANCEL elija el botón Cancelar.

    • PSBTN_HELP elija el botón de Ayuda.

Comentarios

Vea PSM_PRESSBUTTON para obtener más información sobre el mensaje de Windows SDK Pressbutton.

Una llamada a PressButton no enviará una notificación de PSN_APPLY de una página de propiedades al marco.Para enviar esta notificación, llame a CPropertyPage::OnOK.

Ejemplo

// 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);
}

Requisitos

encabezado: afxdlgs.h

Vea también

Referencia

Clase de CPropertySheet

Gráfico de jerarquía