Re: How decode encoded Base64 to string text?

2019-11-08 Thread Marcone via Digitalmars-d-learn
On Friday, 8 November 2019 at 12:36:37 UTC, Aldo wrote: On Friday, 8 November 2019 at 11:46:44 UTC, Marcone wrote: I can encode "Helo World!" to Base64 and get "TWFyY29uZQ==", but if I try to decode "TWFyY29uZQ==" I can not recovery "Helo World!" but [77, 97, 114, 99, 111, 110, 101]. How can I

I need "duic.cpp" already compiled for .exe for convert .ui files to .d for Dlang

2019-11-08 Thread Marcone via Digitalmars-d-learn
Hi, I'm at the beginning of Dlang studies. I want to create a graphical interface for my program. I use Qt Designer to draw the GUI and save to .ui file. Could someone send me the file "duic.exe" which converts .ui files into .d for Dlang? I need the "duic.cpp" already compiled for .exe. I

Dlang + QtE5 + "Qt Designer": How convert .ui to .d Grafic Interface?

2019-11-14 Thread Marcone via Digitalmars-d-learn
Hi, I use Dlang with QtE5 to make my programs with GUI. I want to design my program with "Qt Designer" and convert .ui file to .d file for use with Dlang + QtE5. In Python, Ruby, C++ you can designe GUI using "Qt Designer" and convert to respective language using uic.exe. I found this duic

Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Marcone via Digitalmars-d-learn
I am using this function to sleep, but I want a simple Alias. How can I alias this? // Function sleep(int) void sleep(int seconds){ Thread.sleep(dur!("seconds")( seconds )); } sleep(1); // Using function.

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Marcone via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 22:26:48 UTC, Daniel Kozak wrote: On Tuesday, 12 November 2019 at 21:24:54 UTC, Marcone wrote: I am using this function to sleep, but I want a simple Alias. How can I alias this? // Function sleep(int) void sleep(int seconds){

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Marcone via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 22:26:48 UTC, Daniel Kozak wrote: On Tuesday, 12 November 2019 at 21:24:54 UTC, Marcone wrote: I am using this function to sleep, but I want a simple Alias. How can I alias this? // Function sleep(int) void sleep(int seconds){

How decode encoded Base64 to string text?

2019-11-08 Thread Marcone via Digitalmars-d-learn
I can encode "Helo World!" to Base64 and get "TWFyY29uZQ==", but if I try to decode "TWFyY29uZQ==" I can not recovery "Helo World!" but [77, 97, 114, 99, 111, 110, 101]. How can I recover "Helo World!" when decode? Thank you. import std; void main(){ string text = "Helo World!";

How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-08 Thread Marcone via Digitalmars-d-learn
I want to add version to my program. I have configurated my version file "version.txt", but I dont know how link this file to my program. If Need spec file, please send the exemple code of spec. Or is is possible add version file by dmd command line or resources. Thank you.

Re: How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-08 Thread Marcone via Digitalmars-d-learn
On Sunday, 8 December 2019 at 20:56:05 UTC, mipri wrote: On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote: I want to add version to my program. I have configurated my version file "version.txt", but I dont know how link this file to my program. If Need spec file, please send the

How Use/Load/Recovery Files in resource.res files?

2019-12-08 Thread Marcone via Digitalmars-d-learn
I have added files inside resource.res. The icon.ico is automated used for exe program icon. But I don't know how use others files inside resource res. How Use/Load/Recovery Files in resource.res files?

How to invert bool false/true in alias compose?

2019-12-06 Thread Marcone via Digitalmars-d-learn
import std; alias cmd = compose!(to!bool, wait, spawnShell, to!string); void main(){ writeln(cmd("where notepad.exe")); } Result: C:\Windows\System32\notepad.exe C:\Windows\notepad.exe false The result show "false" because good spawnshell command return 0 and 0 to bool is false.

Re: How to invert bool false/true in alias compose?

2019-12-06 Thread Marcone via Digitalmars-d-learn
On Saturday, 7 December 2019 at 04:05:23 UTC, mipri wrote: On Saturday, 7 December 2019 at 04:00:53 UTC, Marcone wrote: import std; alias cmd = compose!(to!bool, wait, spawnShell, to!string); void main(){ writeln(cmd("where notepad.exe")); } Result: C:\Windows\System32\notepad.exe

Re: How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-10 Thread Marcone via Digitalmars-d-learn
On Tuesday, 10 December 2019 at 07:23:00 UTC, rumbu wrote: On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote: I want to add version to my program. I have configurated my version file "version.txt", but I dont know how link this file to my program. If Need spec file, please send the

Re: How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-10 Thread Marcone via Digitalmars-d-learn
On Tuesday, 10 December 2019 at 09:48:11 UTC, ShadoLight wrote: On Tuesday, 10 December 2019 at 07:23:00 UTC, rumbu wrote: [...] To add to Rumbo's comment: to compile a *.rc to *.res file you will need a resource compiler. [...] Hi, I compile resource using windres.exe of MinGW, Can you

How use Resedit Dialogs + Dlang?

2019-12-14 Thread Marcone via Digitalmars-d-learn
There's a way to create simple GUI for Dlang using Resedit? How?

Re: How use Resedit Dialogs + Dlang?

2019-12-15 Thread Marcone via Digitalmars-d-learn
On Sunday, 15 December 2019 at 13:19:21 UTC, JN wrote: On Sunday, 15 December 2019 at 04:00:14 UTC, Marcone wrote: There's a way to create simple GUI for Dlang using Resedit? How? Do you know how to do it with C++? It should work the same in D, just use the WinApi bindings for calls. No. I

Re: How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-10 Thread Marcone via Digitalmars-d-learn
On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote: I want to add version to my program. I have configurated my version file "version.txt", but I dont know how link this file to my program. If Need spec file, please send the exemple code of spec. Or is is possible add version file by

How bundles a Dlang application and all its dependencies into a single .exe package?

2019-12-01 Thread Marcone via Digitalmars-d-learn
My program have Qt5 GUI that use dlls, icons, pictures, etc. How bundles a Dlang application and all its dependencies into a single .exe package?

Slice/Substr [0..?lastIndexOf(".")] How refer itself without create a variable?

2019-12-05 Thread Marcone via Digitalmars-d-learn
Simple example: writeln("Hi\nHow are you?\nGood".splitLines()[0][0..?lastIndexOf(r"\")]); How to refer to this string in lastIndexOf() without create a variable? Thank you.

Re: books for learning D

2020-02-09 Thread Marcone via Digitalmars-d-learn
Programming in D - Tutorial and Reference 1st Edition Free PDF Book. Download: http://ddili.org/ders/d.en/index.html

How make wsatring or dstring default for string and literals?

2020-02-24 Thread Marcone via Digitalmars-d-learn
I live in Brazil and speak português brasileiro and need make programs that is good with words like ã, á, ç, ê, etc. How can I make wstring or dstring default for string and literals? I don't want to explicit this every time.

Re: How make wsatring or dstring default for string and literals?

2020-02-24 Thread Marcone via Digitalmars-d-learn
On Monday, 24 February 2020 at 19:28:43 UTC, Adam D. Ruppe wrote: On Monday, 24 February 2020 at 19:27:04 UTC, Marcone wrote: I live in Brazil and speak português brasileiro and need make programs that is good with words like ã, á, ç, ê, etc. Regular string works with those just fine too.

DMD: Is it possible change compile time errors to runtime errors in Dlang?

2020-03-05 Thread Marcone via Digitalmars-d-learn
Is it possible change compile time errors to runtime errors in Dlang? If yes, how can I make it?

Re: DMD: Is it possible change compile time errors to runtime errors in Dlang?

2020-03-06 Thread Marcone via Digitalmars-d-learn
On Friday, 6 March 2020 at 05:31:57 UTC, Mathias Lang wrote: On Friday, 6 March 2020 at 04:56:28 UTC, Marcone wrote: Is it possible change compile time errors to runtime errors in Dlang? If yes, how can I make it? No it's not possible, D is a statically typed language. Why would you want

How to convert this C++ code to Dlang? Please send me Dlang version of this C++ code

2020-01-27 Thread Marcone via Digitalmars-d-learn
#include #include #include #include "resource.h" #include HINSTANCE hInst; BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { } return TRUE; case WM_CLOSE: { EndDialog(hwndDlg, 0);

Re: How to convert this C++ code to Dlang? Please send me Dlang version of this C++ code

2020-01-27 Thread Marcone via Digitalmars-d-learn
On Monday, 27 January 2020 at 13:07:20 UTC, rumbu wrote: On Monday, 27 January 2020 at 11:34:47 UTC, Marcone wrote: [...] Translated (including errors & comments): import core.sys.windows.windows; import core.sys.windows.commctrl; import std.stdio; HINSTANCE hInst; extern(Windows): BOOL

How change window Backgound Color when press a Button when using "ResEdit Resource Editor" to design?

2020-01-29 Thread Marcone via Digitalmars-d-learn
I created a GUI using "ResEdit Resource Editor" and embeded to Dlang using this code above. Now I want to change the window Backgound Color when press a Button. How can I make it? import core.sys.windows.windows; import core.sys.windows.commctrl; import std.stdio; pragma(lib, "gdi32.lib");

Re: How change window Backgound Color when press a Button when using "ResEdit Resource Editor" to design?

2020-01-29 Thread Marcone via Digitalmars-d-learn
On Thursday, 30 January 2020 at 04:29:42 UTC, bauss wrote: On Thursday, 30 January 2020 at 03:49:29 UTC, Marcone wrote: I created a GUI using "ResEdit Resource Editor" and embeded to Dlang using this code above. Now I want to change the window Backgound Color when press a Button. How can I

Re: What is wrong with this function that I can not get resource content?

2020-02-05 Thread Marcone via Digitalmars-d-learn
Sorry! Solved. Just need add # in this line: get_resource("#300", "BMP", "melancia.bmp");

What is wrong with this function that I can not get resource content?

2020-02-05 Thread Marcone via Digitalmars-d-learn
// Function get_resource() void get_resource(const(wchar)* id, const(wchar)* tipo, const(wchar)* path_name){ HRSRC file = FindResource(null, id, tipo); DWORD size = SizeofResource(NULL, file); HGLOBAL load = LoadResource(NULL, file); HANDLE new_file =

Re: What is wrong with this function that I can not get resource content?

2020-02-05 Thread Marcone via Digitalmars-d-learn
I get resource "melancia.bmp" but the file is corrupted.

How add resource.res in RDMD

2020-02-01 Thread Marcone via Digitalmars-d-learn
I like use rdmd when I am programming. But I need that the program use resource file becouse I am creating program with gui win32api. How can I add resource when use rdmd?

Re: How add resource.res in RDMD

2020-02-03 Thread Marcone via Digitalmars-d-learn
On Monday, 3 February 2020 at 05:11:30 UTC, Boris Carvajal wrote: On Monday, 3 February 2020 at 03:03:20 UTC, Marcone wrote: On Sunday, 2 February 2020 at 06:03:06 UTC, Marcone wrote: I like use rdmd when I am programming. But I need that the program use resource file becouse I am creating

Re: How make Executable Dlang EXE ask for "Run as Administrator"?

2020-02-03 Thread Marcone via Digitalmars-d-learn
On Saturday, 1 February 2020 at 08:14:19 UTC, Ferhat Kurtulmuş wrote: On Saturday, 1 February 2020 at 06:26:04 UTC, Marcone wrote: [...] Disclaimer: did not tried. You must somehow embed this manifest file into your exe using some linker parameter. Or put this manifest next to your exe by

Re: How make Executable Dlang EXE ask for "Run as Administrator"?

2020-02-07 Thread Marcone via Digitalmars-d-learn
Solved adding this code in resource.rc, converted to resource.res and linked to .d source. This code add the file "manifest.manifest" to resource. 1 24 "manifest.manifest"

How to converte string to wstring[]?

2020-02-06 Thread Marcone via Digitalmars-d-learn
How to converte "string" to wstring[] in Dlang?

Re: How to converte string to wstring[]?

2020-02-08 Thread Marcone via Digitalmars-d-learn
On Friday, 7 February 2020 at 06:20:09 UTC, novice2 wrote: import std.conv: to; string str = "test1"; wstring[] wstr = [to!wstring(str)]; Thank you!

Re: total newbie + IDE

2020-02-08 Thread Marcone via Digitalmars-d-learn
You don't need an IDE for run Dlang. I Use "Sublime Text". Very good for Dlang.

How to convert "string" to const(wchar)* ?

2020-01-28 Thread Marcone via Digitalmars-d-learn
How to convert "string" to const(wchar)* ? The code bellow is making confuse strange characters. cast(wchar*) str

Re: How to convert this C++ code to Dlang? Please send me Dlang version of this C++ code

2020-01-27 Thread Marcone via Digitalmars-d-learn
On Monday, 27 January 2020 at 13:41:13 UTC, Ferhat Kurtulmuş wrote: On Monday, 27 January 2020 at 13:24:03 UTC, Marcone wrote: On Monday, 27 January 2020 at 13:07:20 UTC, rumbu wrote: [...] Thank you very much! But I have this error when I try to compile: Error 42: Symbol Undefined

Re: How add resource.res in RDMD

2020-02-02 Thread Marcone via Digitalmars-d-learn
On Sunday, 2 February 2020 at 06:03:06 UTC, Marcone wrote: I like use rdmd when I am programming. But I need that the program use resource file becouse I am creating program with gui win32api. How can I add resource when use rdmd? No one knows how add resource .res file in rdmd?

How make Executable Dlang EXE ask for "Run as Administrator"?

2020-01-31 Thread Marcone via Digitalmars-d-learn
I created a program in Dlang and compiled to exe using dmd. But my program need administrator privileges. How can I make executable dlang program ask for administrator privileges on start up program?

Win32 Api: How create a Color Dialog?

2020-01-09 Thread Marcone via Digitalmars-d-learn
I am creating a GUI using winsamp.d as model. See the window here: https://i.ibb.co/ZJ4v2KD/Sem-t-tulo.png I want to ask a user for choose a color when click Configuration/Color, and then change backgroud color of GUI. But how can I create a Color Dialog? There's dlang example in the web and I

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-11 Thread Marcone via Digitalmars-d-learn
On Friday, 10 January 2020 at 15:44:53 UTC, Mike Parker wrote: On Friday, 10 January 2020 at 15:06:07 UTC, Marcone wrote: Very complicated. Can you send me the simple clear code? https://docs.microsoft.com/en-us/windows/win32/dlgbox/using-common-dialog-boxes Not compile in Dlang.

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-11 Thread Marcone via Digitalmars-d-learn
On Friday, 10 January 2020 at 14:48:49 UTC, Marcone wrote: How create "Open" and "Save as" Dialog using "Win32 Api" and Dlang? Please send me a simple example code in Dlang. Thank you very much. This code works, but I can't get file Path. Someone can help me? import std; import

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-11 Thread Marcone via Digitalmars-d-learn
On Saturday, 11 January 2020 at 00:12:03 UTC, René Heldmaier wrote: On Friday, 10 January 2020 at 14:48:49 UTC, Marcone wrote: How create "Open" and "Save as" Dialog using "Win32 Api" and Dlang? Please send me a simple example code in Dlang. Thank you very much. Have a look at this website:

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-11 Thread Marcone via Digitalmars-d-learn
On Friday, 10 January 2020 at 14:48:49 UTC, Marcone wrote: How create "Open" and "Save as" Dialog using "Win32 Api" and Dlang? Please send me a simple example code in Dlang. Thank you very much. Solution: import std; import core.sys.windows.windows; pragma(lib, "comdlg32"); // Function

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-12 Thread Marcone via Digitalmars-d-learn
On Saturday, 11 January 2020 at 14:21:25 UTC, Adam D. Ruppe wrote: On Saturday, 11 January 2020 at 12:22:25 UTC, Marcone wrote: wchar[1024] szFileName = 0; ofn.lpstrFile = cast(LPWSTR) szFileName; You shouldn't cast there, just use `szFileName.ptr` instead. ofn.nMaxFile =

Re: How to remove whitespace from a string

2020-01-17 Thread Marcone via Digitalmars-d-learn
On Thursday, 16 January 2020 at 13:36:10 UTC, Namal wrote: Hello, what is the way to remove whitespace from a string (not only at the beginning and end).. import std; void main(){ string name = " Marvin Will "; writeln(name.replace(" ", "")); // MarvinWill }

Win32 Api: How create Open/"Save as" Dialog?

2020-01-10 Thread Marcone via Digitalmars-d-learn
How create "Open" and "Save as" Dialog using "Win32 Api" and Dlang? Please send me a simple example code in Dlang. Thank you very much.

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-10 Thread Marcone via Digitalmars-d-learn
On Friday, 10 January 2020 at 14:52:36 UTC, Adam D. Ruppe wrote: On Friday, 10 January 2020 at 14:48:49 UTC, Marcone wrote: How create "Open" and "Save as" Dialog using "Win32 Api" and Dlang? Please send me a simple example code in Dlang. Thank you very much. You just call GetOpenFileName or

Re: Win32 Api: How create a Color Dialog?

2020-01-10 Thread Marcone via Digitalmars-d-learn
On Thursday, 9 January 2020 at 21:55:26 UTC, Dennis wrote: On Thursday, 9 January 2020 at 13:04:33 UTC, Marcone wrote: [...] Windows has the 'common dialog' module with a ChooseColor function you can use. [...] Very Good! Working very well!

Re: How run program with RDMD when code need load C++ code compiled by DMC to .obj?

2020-01-02 Thread Marcone via Digitalmars-d-learn
On Friday, 3 January 2020 at 05:12:21 UTC, Marcone wrote: Using dmd run compile very whell: dmd Program.obj cpp.obj But with rdmd not work. extern(C++) void teste(); void main(){ teste(); } OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights

How run program with RDMD when code need load C++ code compiled by DMC to .obj?

2020-01-02 Thread Marcone via Digitalmars-d-learn
Using dmd run compile very whell: dmd Program.obj cpp.obj But with rdmd not work.

Re: Concatenation/joining strings together in a more readable way

2019-12-31 Thread Marcone via Digitalmars-d-learn
On Monday, 30 December 2019 at 14:56:59 UTC, mipri wrote: On Monday, 30 December 2019 at 10:23:14 UTC, Marcone wrote: On Monday, 30 December 2019 at 09:41:55 UTC, mipri wrote: This leaks too much. writeln("Helo {} {}".format("xx", "name")); // Helo xx name writeln("Helo {}

Re: Concatenation/joining strings together in a more readable way

2019-12-31 Thread Marcone via Digitalmars-d-learn
On Monday, 30 December 2019 at 14:56:59 UTC, mipri wrote: On Monday, 30 December 2019 at 10:23:14 UTC, Marcone wrote: On Monday, 30 December 2019 at 09:41:55 UTC, mipri wrote: This leaks too much. writeln("Helo {} {}".format("xx", "name")); // Helo xx name writeln("Helo {}

Re: Concatenation/joining strings together in a more readable way

2020-01-01 Thread Marcone via Digitalmars-d-learn
On Wednesday, 25 December 2019 at 12:39:08 UTC, BoQsc wrote: Are there any other ways to join two strings without Tilde ~ character? I can't seems to find anything about Tilde character concatenation easily, nor the alternatives to it. Can someone share some knowledge on this or at least point

Re: Concatenation/joining strings together in a more readable way

2020-01-02 Thread Marcone via Digitalmars-d-learn
On Wednesday, 25 December 2019 at 12:39:08 UTC, BoQsc wrote: Are there any other ways to join two strings without Tilde ~ character? I can't seems to find anything about Tilde character concatenation easily, nor the alternatives to it. Can someone share some knowledge on this or at least point

Re: What kind of Editor, IDE you are using and which one do you like for D language?

2019-12-24 Thread Marcone via Digitalmars-d-learn
On Sunday, 22 December 2019 at 17:20:51 UTC, BoQsc wrote: There are lots of editors/IDE's that support D language: https://wiki.dlang.org/Editors What kind of editor/IDE are you using and which one do you like the most? I am using "Sublime Text" for code Dlang.

How create a function that receive a function and run it in another threading?

2019-12-26 Thread Marcone via Digitalmars-d-learn
import std; import core.thread; auto threading(lazy void fun){ return task!fun().executeInNewThread(); } void main(){ threading(writeln("Hello World!")); } I want to create a function threading() to run some function in other threading, but I get this error bellow. How can I get

How can I use a file that is inside resource .res?

2019-12-28 Thread Marcone via Digitalmars-d-learn
I created a file called "resource.rc" with this content: 1 ICON icon.ico 2 EXE app.exe And compiled with this command: windres.exe resource.rc resource.res And I binf it to my program with this command: dmd Program.d resource.res Now I have a Program.exe with "app.exe" inside. Now the file

Re: Concatenation/joining strings together in a more readable way

2019-12-30 Thread Marcone via Digitalmars-d-learn
On Monday, 30 December 2019 at 09:41:55 UTC, mipri wrote: On Monday, 30 December 2019 at 06:47:37 UTC, Marcone wrote: Use Python format() style: import std; import std: Format = format; // format() string format(T...)(T text){ string texto = text[0]; foreach(count, i;

Re: Concatenation/joining strings together in a more readable way

2019-12-29 Thread Marcone via Digitalmars-d-learn
On Wednesday, 25 December 2019 at 13:07:44 UTC, mipri wrote: On Wednesday, 25 December 2019 at 12:39:08 UTC, BoQsc wrote: Are there any other ways to join two strings without Tilde ~ character? I can't seems to find anything about Tilde character concatenation easily, nor the alternatives to

How load icon from resource using LoadImage?

2020-01-05 Thread Marcone via Digitalmars-d-learn
I am using this code to load icon from local directory, but I want to load icon from resource.res file: wndclass.hIcon = LoadImage( NULL, "icon.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE| LR_SHARED | LR_LOADTRANSPARENT);

Re: How load icon from resource using LoadImage?

2020-01-05 Thread Marcone via Digitalmars-d-learn
On Sunday, 5 January 2020 at 15:13:17 UTC, Rumbu wrote: On Sunday, 5 January 2020 at 13:33:35 UTC, Marcone wrote: I am using this code to load icon from local directory, but I want to load icon from resource.res file: wndclass.hIcon = LoadImage( NULL, "icon.ico", IMAGE_ICON, 0, 0,

Re: How create a function that receive a function and run it in another threading?

2019-12-27 Thread Marcone via Digitalmars-d-learn
On Friday, 27 December 2019 at 07:06:52 UTC, mipri wrote: On Friday, 27 December 2019 at 06:08:16 UTC, Marcone wrote: import std; import core.thread; auto threading(lazy void fun){ return task!fun().executeInNewThread(); } void main(){ threading(writeln("Hello World!")); } I want

How can I append PATH to environment["PATH"] in runtime?

2020-03-13 Thread Marcone via Digitalmars-d-learn
environment["PATH"] ~= r";D:\folder\"; // Error

How catch any error in Dlang like Python try-except?

2020-03-14 Thread Marcone via Digitalmars-d-learn
How catch any error in Dlang like Python tray-except? It is very useful when making tests. But only who came from interpreted languages can understand. Exemple: import std; void main() { try { writelnX("try function that not exist"); } catch (Throwable

How convert String to Hex?

2020-04-18 Thread Marcone via Digitalmars-d-learn
How convert String to Hex? Example: string text = "Hello World"; // Converted to Hex = 48656c6c6f20576f726c64

Re: How user dub packages in dmd without dub.exe ?

2020-04-12 Thread Marcone via Digitalmars-d-learn
On Sunday, 5 April 2020 at 14:19:40 UTC, WebFreak001 wrote: On Sunday, 5 April 2020 at 14:02:19 UTC, Baby Beaker wrote: On Saturday, 4 April 2020 at 21:54:34 UTC, Andre Pany wrote: On Saturday, 4 April 2020 at 20:21:03 UTC, Marcone wrote: [...] [...] If you can copy the D packages from the

Re: How can I append PATH to environment["PATH"] in runtime?

2020-03-13 Thread Marcone via Digitalmars-d-learn
On Friday, 13 March 2020 at 13:28:01 UTC, Steven Schveighoffer wrote: On 3/13/20 2:08 AM, Marcone wrote: environment["PATH"] ~= r";D:\folder\"; // Error Did you try the long way? environment["PATH"] = environment["PATH"] ~ r";D:\folder\"; It would be nice to have environment support

How user dub packages in dmd without dub.exe ?

2020-04-04 Thread Marcone via Digitalmars-d-learn
I want import modules from dub packages in my program.d and run using dmd.exe without dub.exe. How can I make it? Becouse when I try to import it says that can not found.

Re: How user dub packages in dmd without dub.exe ?

2020-04-05 Thread Marcone via Digitalmars-d-learn
On Sunday, 5 April 2020 at 14:02:19 UTC, Baby Beaker wrote: On Saturday, 4 April 2020 at 21:54:34 UTC, Andre Pany wrote: On Saturday, 4 April 2020 at 20:21:03 UTC, Marcone wrote: [...] Ag the end dub is calling DMD/LDC with some arguments. You can run dub with verbose output and check the

How package Dlang in a standalone portable executable?

2020-03-26 Thread Marcone via Digitalmars-d-learn
I need package Dlang in a standalone portable executable. I need packcages all dependencies, dlls, files, etc in one executable file.

Re: GUI library for DMD 2.090 or DMD 2.091

2020-04-25 Thread Marcone via Digitalmars-d-learn
On Friday, 24 April 2020 at 13:45:22 UTC, Phrozen wrote: I'm too new to DLang and I have a lot to learn. Probably that's why I have a lot of difficulties. Has anyone tried using a GUI library to the latest DMD 2.090 or DMD 2.091? I plan to use this language for a specific Thermal calculator

How make DMD auto link imported modules?

2020-04-21 Thread Marcone via Digitalmars-d-learn
When I create a module, for exemple mymodule.d and import im my main program using "import mymodule" I need add mymodule.d in DMD command line manually. How can make it automatic?

How can I check if an element is iterable?

2020-05-03 Thread Marcone via Digitalmars-d-learn
How can I check if an element is iterable in Dlang?

Re: How can I check if an element is iterable?

2020-05-03 Thread Marcone via Digitalmars-d-learn
On Sunday, 3 May 2020 at 20:46:30 UTC, Adam D. Ruppe wrote: On Sunday, 3 May 2020 at 20:21:24 UTC, Marcone wrote: How can I check if a variable is iterable? Every variable has a type. You can get it with typeof(varaiable) I need in runtime.

Re: How can I check if an element is iterable?

2020-05-03 Thread Marcone via Digitalmars-d-learn
On Sunday, 3 May 2020 at 20:11:58 UTC, Adam D. Ruppe wrote: On Sunday, 3 May 2020 at 20:02:09 UTC, Marcone wrote: How can I check if an element is iterable in Dlang? http://dpldocs.info/experimental-docs/std.traits.isIterable.html Not working. How can I check if a variable is iterable?

Re: How can I check if an element is iterable?

2020-05-03 Thread Marcone via Digitalmars-d-learn
On Sunday, 3 May 2020 at 20:11:58 UTC, Adam D. Ruppe wrote: On Sunday, 3 May 2020 at 20:02:09 UTC, Marcone wrote: How can I check if an element is iterable in Dlang? http://dpldocs.info/experimental-docs/std.traits.isIterable.html I don't want to check if type is iterable, but if variable

How can I do dmd omite error when if compare two different data types ? (-fpermissive)

2020-05-03 Thread Marcone via Digitalmars-d-learn
In C++ I just use -fpermissive foreach(i; tuple(10, "lemon", false, "John", 1.6, 'c')) { writeln(i); if(i == "John") break; // Error }

Re: How can I check if an element is iterable?

2020-05-04 Thread Marcone via Digitalmars-d-learn
On Monday, 4 May 2020 at 01:49:28 UTC, Ali Çehreli wrote: On 5/3/20 1:44 PM, Marcone wrote: [...] Still, the type of a variable would determine whether whether it's iterable. As an improvement, the following program can be changed to call use() recursively to visit all members of e.g.

What is the best way to refer to itself when obtaining Substring of a literal?

2020-04-24 Thread Marcone via Digitalmars-d-learn
I don't want to use lambda. I don't want create variable. What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable? example: writeln("Hello Word!"[x.indexOf(" "), $]);

Re: What is the best way to refer to itself when obtaining Substring of a literal?

2020-04-25 Thread Marcone via Digitalmars-d-learn
On Saturday, 25 April 2020 at 03:47:33 UTC, SrMordred wrote: On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote: I don't want to use lambda. I don't want create variable. What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable?

Re: What is the best way to refer to itself when obtaining Substring of a literal?

2020-04-25 Thread Marcone via Digitalmars-d-learn
On Saturday, 25 April 2020 at 01:32:54 UTC, 9il wrote: On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote: I don't want to use lambda. I don't want create variable. What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable?

How package Dlang in a standalone portable executable?

2020-08-31 Thread Marcone via Digitalmars-d-learn
I need package Dlang in a standalone portable executable. I need packcages all dependencies, dlls, files, etc in one executable file.

How auto convert Variant to required function arguments?

2020-10-08 Thread Marcone via Digitalmars-d-learn
How auto convert Variant to required function arguments?

Re: Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread Marcone via Digitalmars-d-learn
Solved: Teste * params = cast(Teste*) lParam; writeln(params.nome); writeln(params.idade); But here, how can send struct? DialogBoxParam(null, MAKEINTRESOURCE(IDD_DIALOG1), null, , cast(int) ); // Error, need "int" but I am sending Test*

Re: Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread Marcone via Digitalmars-d-learn
DialogBoxParam receive need "int". How convert struct object reference to int and cast to struct type after? I will cast using: Teste * params = cast(Teste*) LOWORD(lParam); writeln(params.nome); writeln(params.idade); But here, how can send struct? DialogBoxParam(null,

Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread Marcone via Digitalmars-d-learn
struct Teste { string nome = "Paul"; int idade = 33; } extern(Windows): BOOL DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) nothrow { // I want to be able to use the struct object here. // writeln(test.nome); return false; } void chamaJanela(){ Test

Re: Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread Marcone via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 22:46:36 UTC, starcanopy wrote: On Tuesday, 13 October 2020 at 22:26:35 UTC, Marcone wrote: [...] Instead of calling DialogBox, you might try DialogBoxParam[A|W]. [...] - https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-dialogboxparamw

Re: Win32Api GetDlgItemText How make buffer with no fixed size?

2020-10-12 Thread Marcone via Digitalmars-d-learn
On Saturday, 10 October 2020 at 12:31:14 UTC, Adam D. Ruppe wrote: On Saturday, 10 October 2020 at 10:15:03 UTC, Marcone wrote: wchar[100] buffer; // I don't want fixed size :( wchar[] buffer; // no fixed size buffer.length = GetWindowTextLength(hwn); // set it to the text length of the

How to specify which parameters a function that is received as an argument should receive?

2020-10-13 Thread Marcone via Digitalmars-d-learn
How to specify which parameters a function that is received as an argument should receive? Example: import std; void myfun(int n){ writeln(n); } void test(lazy void delegate() fun) // how specify that "fun" may receive int ? { fun(int); } test({myfun;});

How can I convert Hexadecimal to RGB Color and vice-versa?

2020-10-16 Thread Marcone via Digitalmars-d-learn
How can I convert Hexadecimal to RGB Color and vice-versa?

How convert String to Fixed wchar Array?

2020-10-16 Thread Marcone via Digitalmars-d-learn
How convert String to Fixed wchar Array? import std; void main(){ string name = "Marvin"; wchar[255] wtext = name.to!(wchar[]); // Can not convert. writeln(wtext); }

Win32Api GetDlgItemText How make buffer with no fixed size?

2020-10-10 Thread Marcone via Digitalmars-d-learn
wchar[100] buffer; // I don't want fixed size :( GetDlgItemText(hwn, widget, buffer.ptr, buffer.sizeof);

Since DMD 2.089.0 and later, compiled .exe showing SFX zip and opening with winRar when use resource.

2020-08-18 Thread Marcone via Digitalmars-d-learn
When I compile the source .d code to .exe adding an icon using resource .res file in dmd 2.089.0 and later, the .exe file show SFX zip in it is properties and open with winRar. This ir normal or is a Bug? See images below. Se image in this links: SFX zip in it is properties:

Re: Since DMD 2.089.0 and later, compiled .exe showing SFX zip and opening with winRar when use resource.

2020-08-30 Thread Marcone via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 08:27:34 UTC, Kagamin wrote: On Tuesday, 18 August 2020 at 19:01:17 UTC, Marcone wrote: SFX zip in it is properties: https://i.imgur.com/dH7jl5n.png Opening with winRar: https://i.imgur.com/s7C9mZn.png Probably winrar messing with your file manager. Try to

Re: I need "windowsx.d" Someone can send It to me?

2020-09-25 Thread Marcone via Digitalmars-d-learn
On Saturday, 26 September 2020 at 01:43:00 UTC, Denis Feklushkin wrote: On Saturday, 26 September 2020 at 00:40:21 UTC, Marcone wrote: On Friday, 25 September 2020 at 17:00:04 UTC, Denis Feklushkin wrote: On Friday, 25 September 2020 at 15:03:56 UTC, Marcone wrote: I need windowsx.d but for I

How create Win32api Thread in Dlang?

2020-09-25 Thread Marcone via Digitalmars-d-learn
This is C++ code: #include WINAPI DWORD threadFunc(LPVOID x) { while (true) { try { throw 1; } catch (...) { } } return 0; } int main(int argc, char *argv[]) { CreateThread(NULL, 0, threadFunc, NULL, 0, NULL); CreateThread(NULL, 0, threadFunc, NULL, 0, NULL);

  1   2   3   >