getting Win32 Messagebox to work

Mark Moorhen Mark at Moorhen.com
Fri Oct 26 15:10:14 UTC 2018


On Friday, 26 October 2018 at 13:59:17 UTC, Adam D. Ruppe wrote:
> On Friday, 26 October 2018 at 12:36:42 UTC, Mark Moorhen wrote:
>> Can anyone help me out with this?
>
> Yeah, let me make a few general points here:
>
....

> Welcome to the wonderful world of wide strings and D Windows 
> programming! :)

Wow, that's a lot of info, but it makes things a lot clearer. I 
ended up with this:

import core.runtime;
import std.utf;
import core.sys.windows.windows;

extern (Windows)
void WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR 
lpCmdLine, int iCmdShow)
{
	const(wchar*)  foo = toUTF16z("hello"w[0 .. 2]);
	MessageBoxW(null, foo, "hi", 0);
}

It does compile, but does not run as expected. Any clues?




More information about the Digitalmars-d-learn mailing list