CreateCaret function user32

Win32Result<bool> CreateCaret(
  1. HWND hWnd,
  2. HBITMAP? hBitmap,
  3. int nWidth,
  4. int nHeight,
)

Creates a new shape for the system caret and assigns ownership of the caret to the specified window.

The caret shape can be a line, a block, or a bitmap.

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

Implementation

Win32Result<bool> CreateCaret(
  HWND hWnd,
  HBITMAP? hBitmap,
  int nWidth,
  int nHeight,
) {
  resolveGetLastError();
  final result_ = _CreateCaret(hWnd, hBitmap ?? nullptr, nWidth, nHeight);
  return .new(value: result_ != FALSE, error: GetLastError());
}