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
If we look at the docs for GetWindowLongPtrA (or any of the A/W Long/LongPtr variants), they all can fail by returning 0, however the generated bindings just return an isize: GetWindowLongPtrA.
The error handling might not be as simple as checking for 0 and returning a Result since a proper return type would be Result<Option<isize>>, where it returns Ok(None) when the function returns 0 without having an error (for example when SetWindowLong has not been called).
I've never actually seen it fail so I'm not entirely sure what the fail conditions vs succeed conditions on a 0 return look like (and the docs aren't very clear), but it would be nice to have the error helpers applied to these functions.
The returned value on the Ptr variants is also a pointer, but it's probably best to keep it as an isize since GetWindowLongPtrA and GetWindowLongPtrW return pseudo-values when the wrong A/W version is called.
The text was updated successfully, but these errors were encountered:
I think this is a case where the caller needs to figure things out since the way that errors are reported is very API specific and cannot be readily inferred through metadata.
Suggestion
If we look at the docs for GetWindowLongPtrA (or any of the A/W Long/LongPtr variants), they all can fail by returning 0, however the generated bindings just return an
isize
: GetWindowLongPtrA.The error handling might not be as simple as checking for 0 and returning a
Result
since a proper return type would beResult<Option<isize>>
, where it returnsOk(None)
when the function returns 0 without having an error (for example whenSetWindowLong
has not been called).I've never actually seen it fail so I'm not entirely sure what the fail conditions vs succeed conditions on a 0 return look like (and the docs aren't very clear), but it would be nice to have the error helpers applied to these functions.
The returned value on the Ptr variants is also a pointer, but it's probably best to keep it as an
isize
sinceGetWindowLongPtrA
andGetWindowLongPtrW
return pseudo-values when the wrong A/W version is called.The text was updated successfully, but these errors were encountered: