Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
BOOL PressButton( int nButton );
Return Value
Nonzero if successful; otherwise zero.
Parameters
nButton
nButton : Identifies the button to be pressed. This parameter can be one of the following values:
PSBTN_BACK Chooses the Back button.
PSBTN_NEXT Chooses the Next button.
PSBTN_FINISH Chooses the Finish button.
PSBTN_OK Chooses the OK button.
PSBTN_APPLYNOW Chooses the Apply Now button.
PSBTN_CANCEL Chooses the Cancel button.
PSBTN_HELP Chooses the Help button.
Remarks
Call this member function to simulate the choice of the specified button in a property sheet. See for more information about the Windows SDK Pressbutton message.
Example
// 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(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);
}