CreateIcon function user32

Win32Result<HICON> CreateIcon(
  1. HINSTANCE? hInstance,
  2. int nWidth,
  3. int nHeight,
  4. int cPlanes,
  5. int cBitsPixel,
  6. Pointer<Uint8> lpbANDbits,
  7. Pointer<Uint8> lpbXORbits,
)

Creates an icon that has the specified size, colors, and bit patterns.

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

Implementation

Win32Result<HICON> CreateIcon(
  HINSTANCE? hInstance,
  int nWidth,
  int nHeight,
  int cPlanes,
  int cBitsPixel,
  Pointer<Uint8> lpbANDbits,
  Pointer<Uint8> lpbXORbits,
) {
  resolveGetLastError();
  final result_ = _CreateIcon(
    hInstance ?? nullptr,
    nWidth,
    nHeight,
    cPlanes,
    cBitsPixel,
    lpbANDbits,
    lpbXORbits,
  );
  return .new(value: .new(result_), error: GetLastError());
}