How to make Create Window Work?
Adam D. Ruppe
destructionator at gmail.com
Wed Dec 9 17:57:49 UTC 2020
On Wednesday, 9 December 2020 at 17:45:18 UTC, Ruby The Roobster
wrote:
> 0, // window menu
here, that's the only int you do and I'm pretty sure that's
supposed a be a HMENU which is a HANDLE, which is a void* rather
than an int.
C will cast 0 to null implicitly, D will not. If there's ever a
case where you need to pass a number as a handle (like some
HBRUSHe among others), you then explicitly cast it like
`cast(HANDLE) -1`. (HANDLE is an alias to void* too so that would
also work)
But for 0 you almost certainly just want to get in the habit of
using the built in `null` instead 0.
re NULL vs null, both are OK here, but since NULL can actually be
overridden by other libs (it is just a library constant) you're
better off consistently using `null` for those too.
More information about the Digitalmars-d-learn
mailing list