digitalmars.D.learn - Does the WInMain function is mandatory ?
- Vinod K Chandran (7/7) Sep 29 2018 Hi,
- rikki cattermole (3/9) Sep 29 2018 null terminated, nothing really special.
- bauss (5/6) Sep 29 2018 To elaborate on this.
- Vinod K Chandran (2/8) Sep 30 2018 Thanks for the reply. Let me check it.
- Adam D. Ruppe (9/11) Sep 30 2018 Not really best for Windows. That's for calling C functions with
- Vinod K Chandran (3/8) Sep 30 2018 Thanks for the reply. But it says "toUTFz" is not defined. do i
- Vinod K Chandran (12/26) Sep 30 2018 I am trying to make this function, but compiler is rejecting all
- Adam D. Ruppe (3/5) Sep 30 2018 import std.utf;
- Vinod K Chandran (4/9) Sep 30 2018 Thanks. It worked.
- Mike Parker (12/15) Sep 30 2018 With the default OPTLINK linker:
- Vinod K Chandran (4/20) Oct 02 2018 Thanks for the reply. I think its better to write a program in
- Vinod K Chandran (5/9) Sep 30 2018 Hi,
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
Sep 29 2018
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 functions ?, If not, please show me how to convert stringsnull terminated, nothing really special.
Sep 29 2018
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
Sep 29 2018
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:Thanks for the reply. Let me check it.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
Sep 30 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.htmlNot 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
Sep 30 2018
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 ""wThanks for the reply. But it says "toUTFz" is not defined. do i missing any import statement ?
Sep 30 2018
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:I am trying to make this function, but compiler is rejecting all my attempts. ```D int MsgBox(string MsgTxt, string titleTxt = "MessageBox") { const wchar* Mesg = toUTFz! (wchar*)(MsgTxt) ; const wchar* Tit = toUTFz! (wchar*)(itleTxt) ; MessageBoxW(null, Mesg, Tit, 0) ; return 0 ; } ```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 ""wThanks for the reply. But it says "toUTFz" is not defined. do i missing any import statement ?
Sep 30 2018
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;
Sep 30 2018
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. 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 ?Thanks for the reply. But it says "toUTFz" is not defined. do i missing any import statement ?import std.utf;
Sep 30 2018
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 case, user32.lib where MessageBoxW and MessageBoxA reside is automatically linked. When using the MS linker: dmd -m64 -L/SUBSYSTEM:windows -L/ENTRY:mainCRTStartup app.d user32.lib In this case, user32.lib is not automatically linked. Replace -m64 with -m32mscoff for 32-bit output with the MS linker. -L passes command line options to the current linker.
Sep 30 2018
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 for the reply. I think its better to write a program in which we can choose this codes from a combobox and click a button to start compiling.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 case, user32.lib where MessageBoxW and MessageBoxA reside is automatically linked. When using the MS linker: dmd -m64 -L/SUBSYSTEM:windows -L/ENTRY:mainCRTStartup app.d user32.lib In this case, user32.lib is not automatically linked. Replace -m64 with -m32mscoff for 32-bit output with the MS linker. -L passes command line options to the current linker.
Oct 02 2018
On Sunday, 30 September 2018 at 06:33:47 UTC, rikki cattermole wrote:No.Hi, Thanks for the reply. I somehow managed to display a messagebox with "const(wchar)*"2. Can we use D strings in win api functions ?, If not, please show me how to convert stringsnull terminated, nothing really special.
Sep 30 2018