You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In certain Win32 functions and COM methods, some parameters are designated as optional, indicating that a 0 (NULL) or nullptr can be passed as an argument, depending on the parameter type.
To enhance the developer experience, these optional parameters can be marked as nullable by the generator. This allows 0 or nullptr to be passed implicitly if the caller passes null.
Consider the CreateWindowEx function as an example, currently projected as:
intCreateWindowEx(
int dwExStyle,
Pointer<Utf16> lpClassName,
Pointer<Utf16> lpWindowName,
int dwStyle,
intX,
intY,
int nWidth,
int nHeight,
int hWndParent,
int hMenu,
int hInstance,
Pointer lpParam) =>_CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth,
nHeight, hWndParent, hMenu, hInstance, lpParam);
final_CreateWindowEx= _user32.lookupFunction<IntPtrFunction(
Uint32 dwExStyle,
Pointer<Utf16> lpClassName,
Pointer<Utf16> lpWindowName,
Uint32 dwStyle,
Int32X,
Int32Y,
Int32 nWidth,
Int32 nHeight,
IntPtr hWndParent,
IntPtr hMenu,
IntPtr hInstance,
Pointer lpParam),
intFunction(
int dwExStyle,
Pointer<Utf16> lpClassName,
Pointer<Utf16> lpWindowName,
int dwStyle,
intX,
intY,
int nWidth,
int nHeight,
int hWndParent,
int hMenu,
int hInstance,
Pointer lpParam)>('CreateWindowExW');
Here's the proposed projection for this function, marking the optional parameters as nullable and implicitly passing 0 or nullptr if the caller passes null:
intCreateWindowEx(
int dwExStyle,
Pointer<Utf16>? lpClassName,
Pointer<Utf16>? lpWindowName,
int dwStyle,
int x,
int y,
int nWidth,
int nHeight,
int? hWndParent,
int? hMenu,
int? hInstance,
Pointer? lpParam) =>_CreateWindowEx(
dwExStyle,
lpClassName ?? nullptr,
lpWindowName ?? nullptr,
dwStyle,
x,
y,
nWidth,
nHeight,
hWndParent ??0,
hMenu ??0,
hInstance ??0,
lpParam ?? nullptr);
final_CreateWindowEx= _user32.lookupFunction<HWNDFunction(
Uint32 dwExStyle,
Pointer<Utf16> lpClassName,
Pointer<Utf16> lpWindowName,
Uint32 dwStyle,
Int32 x,
Int32 y,
Int32 nWidth,
Int32 nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
Pointer lpParam),
intFunction(
int dwExStyle,
Pointer<Utf16> lpClassName,
Pointer<Utf16> lpWindowName,
int dwStyle,
int x,
int y,
int nWidth,
int nHeight,
int hWndParent,
int hMenu,
int hInstance,
Pointer lpParam)>('CreateWindowExW');
The text was updated successfully, but these errors were encountered:
In certain Win32 functions and COM methods, some parameters are designated as optional, indicating that a
0
(NULL) ornullptr
can be passed as an argument, depending on the parameter type.To enhance the developer experience, these optional parameters can be marked as nullable by the generator. This allows
0
ornullptr
to be passed implicitly if the caller passesnull
.Consider the CreateWindowEx function as an example, currently projected as:
Here's the proposed projection for this function, marking the optional parameters as nullable and implicitly passing
0
ornullptr
if the caller passesnull
:The text was updated successfully, but these errors were encountered: