-
Book Overview & Buying
-
Table Of Contents
D Cookbook
By :
When you write a GUI program on Windows, you'll often want to suppress the automatic allocation of a console window while building the release executable.
Let's remove the Windows console by executing the following steps:
Write your program normally.
While compiling, pass –L/subsystem:windows to dmd.
A D program compiles the program to an .exe file, which means it can use all the same linker capabilities as a program in C, including subsystems, 16-bit stubs (though D itself cannot be compiled to 16 bits), resources, and manifests.
The –L option of dmd forwards the given option to the linker. This can be used to pass any command to the linker, including the platform-specific ones, such as /subsystem, seen here. By choosing the Windows subsystem, the operating system will not allocate a console.
It is also possible to write a WinMain function in D. If you write WinMain instead of main, the linker will automatically mark it as using...
Change the font size
Change margin width
Change background colour