October 26, 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?


October 26, 2018
On Friday, 26 October 2018 at 15:10:14 UTC, Mark Moorhen wrote:
> It does compile, but does not run as expected. Any clues?

You imported, but never actually called Runtime.initalize().

Just stick that at the top, first thing you do inside WinMain, and it will work. (or use main instead of WinMain!)
1 2
Next ›   Last »