Does the WInMain function is mandatory ?

Adam D. Ruppe destructionator at gmail.com
Sun Sep 30 12:48:17 UTC 2018


On Sunday, 30 September 2018 at 06:56:41 UTC, bauss wrote:
> There is function that does it for you called toStringz()
>
> https://dlang.org/library/std/string/to_stringz.html

Not really best for Windows. That's for calling C functions with 
char*, for Windows, you should be working with wchar* instead.

http://dpldocs.info/experimental-docs/std.utf.toUTFz.html

so usage is:

toUTFz!(wchar*)(your_string_here);


If passing string literals to Windows, you can put a w at the 
end, like:

MessageBoxW(null, "Hello"w, "World"w, 0); // note the ""w


More information about the Digitalmars-d-learn mailing list