Re: getting Win32 Messagebox to work

2018-10-26 Thread Adam D. Ruppe via Digitalmars-d-learn
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 WinMa

Re: getting Win32 Messagebox to work

2018-10-26 Thread Mark Moorhen via Digitalmars-d-learn
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! :)

Re: getting Win32 Messagebox to work

2018-10-26 Thread Adam D. Ruppe via Digitalmars-d-learn
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: * The win32.xxx packages shouldn't be necessary any longer, because they have been merged into the druntime core since those tutorials were written,

Re: getting Win32 Messagebox to work

2018-10-26 Thread Mark Moorhen via Digitalmars-d-learn
On Friday, 26 October 2018 at 13:20:17 UTC, Adam D. Ruppe wrote: 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. Now you've mentioned, I also tried: { const(char)* content = "Some random con

Re: getting Win32 Messagebox to work

2018-10-26 Thread Adam D. Ruppe via Digitalmars-d-learn
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

Re: getting Win32 Messagebox to work

2018-10-26 Thread Mark Moorhen via Digitalmars-d-learn
On Friday, 26 October 2018 at 13:04:21 UTC, Adam D. Ruppe wrote: On Friday, 26 October 2018 at 12:56:21 UTC, rikki cattermole wrote: MessageBoxA(null, cast(const(char)*)content.ptr, cast(const(char)*)"Window title".ptr, 0); Get rid of those casts, they are unnecessary. I got to this:

Re: getting Win32 Messagebox to work

2018-10-26 Thread Mark Moorhen via Digitalmars-d-learn
On Friday, 26 October 2018 at 12:56:21 UTC, rikki cattermole wrote: On 27/10/2018 1:46 AM, Mark Moorhen wrote: On Friday, 26 October 2018 at 12:39:13 UTC, rikki cattermole wrote: On 27/10/2018 1:36 AM, Mark Moorhen wrote: [...] alias string = immutable(char)[]; A slice (string in this case)

Re: getting Win32 Messagebox to work

2018-10-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 26 October 2018 at 12:56:21 UTC, rikki cattermole wrote: MessageBoxA(null, cast(const(char)*)content.ptr, cast(const(char)*)"Window title".ptr, 0); Get rid of those casts, they are unnecessary.

Re: getting Win32 Messagebox to work

2018-10-26 Thread rikki cattermole via Digitalmars-d-learn
On 27/10/2018 1:46 AM, Mark Moorhen wrote: On Friday, 26 October 2018 at 12:39:13 UTC, rikki cattermole wrote: On 27/10/2018 1:36 AM, Mark Moorhen wrote: [...] alias string = immutable(char)[]; A slice (string in this case) is a length + pointer pair. You need to add .ptr on content with a

Re: getting Win32 Messagebox to work

2018-10-26 Thread Mark Moorhen via Digitalmars-d-learn
On Friday, 26 October 2018 at 12:39:13 UTC, rikki cattermole wrote: On 27/10/2018 1:36 AM, Mark Moorhen wrote: [...] alias string = immutable(char)[]; A slice (string in this case) is a length + pointer pair. You need to add .ptr on content with a cast to get to const(char)*. Thanks for yo

getting Win32 Messagebox to work

2018-10-26 Thread Mark Moorhen via Digitalmars-d-learn
Hi, I've recently started looking into D, and I'm afraid i'm gonna need some support to get me going. I work mostly on Windows, so i've downloaded the examples from "https://github.com/AndrejMitrovic/DWinProgramming";. Only these examples do not work out-of-the-box on my machine (Win10, 64-b

Re: getting Win32 Messagebox to work

2018-10-26 Thread rikki cattermole via Digitalmars-d-learn
On 27/10/2018 1:36 AM, Mark Moorhen wrote: Hi, I've recently started looking into D, and I'm afraid i'm gonna need some support to get me going. I work mostly on Windows, so i've downloaded the examples from "https://github.com/AndrejMitrovic/DWinProgramming";. Only these examples do not wo

Re: Help needed to extend the core.thread

2018-10-26 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 26 October 2018 at 01:58:47 UTC, Heromyth wrote: Maybe it's better to extend core.thread.Thread by inheriting it. Am I right? Thanks! Yes, see the example at https://dlang.org/phobos/core_thread.html#.Thread

Re: Pegged: spaces

2018-10-26 Thread drug via Digitalmars-d-learn
25.10.2018 23:34, Michelle Long пишет: Ignores spaces: <- Doesn't: < Concatenates results: <~ Thank you for sharing your results!