dotnet / pinvoke

A library containing all P/Invoke code so you don't have to import it every time. Maintained and updated to support the latest Windows OS.
MIT License
2.12k stars 222 forks source link

Add a few more User32 functions (CursorPos, WindowText, WindowPlacement) #277

Closed vbfox closed 8 years ago

vbfox commented 8 years ago

Add the missing functions evoked in this comment : https://github.com/AArnott/pinvoke/issues/265#issuecomment-238430381

AArnott commented 8 years ago

Looks awesome. :)

vbfox commented 8 years ago

Before merging i'll change the helpers to use heap allocation instead of stackalloc as I realized after the fact that allocating unpredictable amount of memory on the stack might not be the brightest idea regarding stack overflows :)

AArnott commented 8 years ago

allocating unpredictable amount of memory on the stack might not be the brightest idea

Yes, good point. I think we've allowed ourselves to use stackalloc with unknown sizes only when the size is capped to a reasonably small value by some other means (documented max, for example).

vbfox commented 8 years ago

Latest commit is a fun edge case I realized re-reading the helper code: We must use the unicode version of GetWindowTextLength even if it doesn't take any string or char parameter as the value returned depend on char-size