Condividi tramite


CPropertySheet::PressButton

Simula la scelta del pulsante specificato in una finestra delle proprietà.

void PressButton(
   int nButton 
);

Parametri

  • nButton
    nButton: Identifica il pulsante venga raggiunto.Questo parametro può essere uno dei seguenti valori:

    • PSBTN_BACK sceglie il pulsante indietro.

    • PSBTN_NEXT sceglie il pulsante successivo.

    • PSBTN_FINISH sceglie il pulsante fine.

    • PSBTN_OK sceglie il pulsante OK.

    • PSBTN_APPLYNOW sceglie di applicare ora i pulsanti.

    • PSBTN_CANCEL sceglie il pulsante Annulla.

    • PSBTN_HELP sceglie il pulsante?.

Note

Vedere PSM_PRESSBUTTON per ulteriori informazioni sul messaggio pulsante di Windows SDK.

Una chiamata a PressButton non invia una notifica PSN_APPLY da una pagina delle proprietà del framework.Per inviare questa notifica, chiamare CPropertyPage::OnOK.

Esempio

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

Requisiti

Header: afxdlgs.h

Vedere anche

Riferimenti

Classe di CPropertySheet

Grafico della gerarchia