CreateWindowEx function user32

Win32Result<HWND> CreateWindowEx(
  1. WINDOW_EX_STYLE dwExStyle,
  2. PCWSTR? lpClassName,
  3. PCWSTR? lpWindowName,
  4. WINDOW_STYLE dwStyle,
  5. int x,
  6. int y,
  7. int nWidth,
  8. int nHeight,
  9. HWND? hWndParent,
  10. HMENU? hMenu,
  11. HINSTANCE? hInstance,
  12. Pointer<NativeType>? lpParam,
)

Creates an overlapped, pop-up, or child window with an extended window style; otherwise, this function is identical to the CreateWindow function.

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

Implementation

Win32Result<HWND> CreateWindowEx(
  WINDOW_EX_STYLE dwExStyle,
  PCWSTR? lpClassName,
  PCWSTR? lpWindowName,
  WINDOW_STYLE dwStyle,
  int x,
  int y,
  int nWidth,
  int nHeight,
  HWND? hWndParent,
  HMENU? hMenu,
  HINSTANCE? hInstance,
  Pointer? lpParam,
) {
  resolveGetLastError();
  final result_ = _CreateWindowEx(
    dwExStyle,
    lpClassName ?? nullptr,
    lpWindowName ?? nullptr,
    dwStyle,
    x,
    y,
    nWidth,
    nHeight,
    hWndParent ?? nullptr,
    hMenu ?? nullptr,
    hInstance ?? nullptr,
    lpParam ?? nullptr,
  );
  return .new(value: .new(result_), error: GetLastError());
}