October 26, 2018 Re: getting Win32 Messagebox to work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | 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 Re: getting Win32 Messagebox to work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mark Moorhen | 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!)
|
Copyright © 1999-2021 by the D Language Foundation