SendMessage function user32

Win32Result<LRESULT> SendMessage(
  1. HWND hWnd,
  2. int msg,
  3. WPARAM? wParam,
  4. LPARAM? lParam,
)

Sends the specified message to a window or windows.

The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.

To learn more, see learn.microsoft.com/windows/win32/api/winuser/nf-winuser-sendmessagew.

Implementation

Win32Result<LRESULT> SendMessage(
  HWND hWnd,
  int msg,
  WPARAM? wParam,
  LPARAM? lParam,
) {
  final result_ = SendMessageW_Wrapper(
    hWnd,
    msg,
    wParam ?? NULL,
    lParam ?? NULL,
  );
  return Win32Result(value: LRESULT(result_.value.i64), error: result_.error);
}