Re: Does the WInMain function is mandatory ?

2018-10-02 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 15:06:31 UTC, Mike Parker wrote: On Sunday, 30 September 2018 at 14:06:20 UTC, Vinod K Chandran wrote: Thanks. It worked. I would like to compile this as a gui. Now it starts with the cmd. Google search didn't gave me the link i want. Any help ? With the

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 30 September 2018 at 14:06:20 UTC, Vinod K Chandran wrote: Thanks. It worked. I would like to compile this as a gui. Now it starts with the cmd. Google search didn't gave me the link i want. Any help ? With the default OPTLINK linker: dmd -L/SUBSYSTEM:windows app.d In this

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 13:21:59 UTC, Adam D. Ruppe wrote: On Sunday, 30 September 2018 at 13:17:33 UTC, Vinod K Chandran wrote: Thanks for the reply. But it says "toUTFz" is not defined. do i missing any import statement ? import std.utf; Thanks. It worked. I would like to compile

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 13:17:33 UTC, Vinod K Chandran wrote: On Sunday, 30 September 2018 at 12:48:17 UTC, Adam D. Ruppe wrote: 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,

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 30 September 2018 at 13:17:33 UTC, Vinod K Chandran wrote: Thanks for the reply. But it says "toUTFz" is not defined. do i missing any import statement ? import std.utf;

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 12:48:17 UTC, Adam D. Ruppe wrote: 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 Thanks for the reply. But it says

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Adam D. Ruppe via Digitalmars-d-learn
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*

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 06:56:41 UTC, bauss wrote: On Sunday, 30 September 2018 at 06:33:47 UTC, rikki cattermole wrote: null terminated, nothing really special. To elaborate on this. There is function that does it for you called toStringz()

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 30 September 2018 at 06:33:47 UTC, rikki cattermole wrote: No. 2. Can we use D strings in win api functions ?, If not, please show me how to convert strings null terminated, nothing really special. Hi, Thanks for the reply. I somehow managed to display a messagebox with

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread bauss via Digitalmars-d-learn
On Sunday, 30 September 2018 at 06:33:47 UTC, rikki cattermole wrote: null terminated, nothing really special. To elaborate on this. There is function that does it for you called toStringz() https://dlang.org/library/std/string/to_stringz.html

Re: Does the WInMain function is mandatory ?

2018-09-30 Thread rikki cattermole via Digitalmars-d-learn
On 30/09/2018 7:24 PM, Vinod K Chandran wrote: Hi, I would like to do some win api coding in D. I just taste the syntactic sugar but cant do anything more. I have few questions. 1. Does WinMain is needed for a D program in order to use win api ? No. 2. Can we use D strings in win api

Does the WInMain function is mandatory ?

2018-09-30 Thread Vinod K Chandran via Digitalmars-d-learn
Hi, I would like to do some win api coding in D. I just taste the syntactic sugar but cant do anything more. I have few questions. 1. Does WinMain is needed for a D program in order to use win api ? 2. Can we use D strings in win api functions ?, If not, please show me how to convert strings