Help Center

CButton.Clickmethod

Simulates the user clicking a button.

WindowsmethodCButton.incdocumented

Syntax

SUb Click (BYVAL hButton AS HWND)

Description

Simulates the user clicking a button. This message causes the button to receive the WM_LBUTTONDOWN and WM_LBUTTONUP messages, and the button's parent window to receive a BN_CLICKED notification code.

Remarks

If the button is in a dialog box and the dialog box is not active, the BM_CLICK message might fail. To ensure success in this situation, call the SetActiveWindow function to activate the dialog box before sending the BM_CLICK message to the button.

Example

CButton.Click(hButton)

Reference

  • Include file CButton.inc
  • Defined in AfxNova/CButton.inc:130
  • Documented in Windows/WIndows Controls/CButton Class.md
  • Topic: CButton Class