getting Win32 Messagebox to work

Adam D. Ruppe destructionator at gmail.com
Fri Oct 26 13:20:17 UTC 2018


On Friday, 26 October 2018 at 13:13:07 UTC, Mark Moorhen wrote:
> But how would you do this without casts?

If that doesn't compile without casts, you don't want it to 
compile - casting is often a mistake; the compiler is trying to 
tell you something.

Let me guess, it is saying something like cannot implicitly cast 
X of type const(char)* to const(wchar)* ?

That difference between char and wchar is very important, and 
casting it away will not run correctly.

Whereas just immutable -> const is an implicit cast and the 
compiler will do it for you since it will not generate wrong code.

But this is why rikki posted MessageBoxA and your code has just 
MessageBox - it is a way around it (not the best way, but a 
working way). I'm typing a longer post right now explaining this 
in more detail.


More information about the Digitalmars-d-learn mailing list