Thread overview
How to disable the DOS window at the start of my program on D
Jul 24, 2013
MGW
Jul 24, 2013
Rikki Cattermole
Jul 24, 2013
MGW
Jul 24, 2013
Rikki Cattermole
Jul 24, 2013
Mike Parker
Jul 24, 2013
MGW
Jul 24, 2013
Adam D. Ruppe
July 24, 2013
I work with Qt from D and I do not need the DOS window. How to turn it off.
July 24, 2013
On Wednesday, 24 July 2013 at 07:00:35 UTC, MGW wrote:
> I work with Qt from D and I do not need the DOS window. How to turn it off.

Generally speaking to disable the console window on Windows by using code only something along these lines will work.

version(Windows) {
    import core.sys.windows.windows : FreeConsole;
    FreeConsole();
}

There is a way to instruct the linker to remove it also but thats more fun.
July 24, 2013
On Wednesday, 24 July 2013 at 08:08:19 UTC, Rikki Cattermole wrote:
> version(Windows) {
>     import core.sys.windows.windows : FreeConsole;
>     FreeConsole();
> }

DOS window flashes at the start, and that's bad.
July 24, 2013
On Wednesday, 24 July 2013 at 08:16:39 UTC, MGW wrote:
> On Wednesday, 24 July 2013 at 08:08:19 UTC, Rikki Cattermole wrote:
>> version(Windows) {
>>    import core.sys.windows.windows : FreeConsole;
>>    FreeConsole();
>> }
>
> DOS window flashes at the start, and that's bad.

Take a look at DLL def files. I believe from memory that they will help with that.

For Microsofts linker (64bit) take a look at http://msdn.microsoft.com/en-us/library/vstudio/fcc1zstk.aspx and /SUBSYSTEM:Windows.
For an example .def file (thats has been made for a dll but should work ok) look at http://dlang.org/dll.html at mydll.def.

The later should work for both 64bit and 32bit I believe.
July 24, 2013
For Win32/OPTLINK, I passed the following flag to dmd in a lil' project of mine:

   -L/SUBSYSTEM:WINDOWS:4.0

Worked for me.

LMB



On Wed, Jul 24, 2013 at 5:24 AM, Rikki Cattermole <alphaglosined@gmail.com> wrote:
> On Wednesday, 24 July 2013 at 08:16:39 UTC, MGW wrote:
>>
>> On Wednesday, 24 July 2013 at 08:08:19 UTC, Rikki Cattermole wrote:
>>>
>>> version(Windows) {
>>>    import core.sys.windows.windows : FreeConsole;
>>>    FreeConsole();
>>> }
>>
>>
>> DOS window flashes at the start, and that's bad.
>
>
> Take a look at DLL def files. I believe from memory that they will help with that.
>
> For Microsofts linker (64bit) take a look at
> http://msdn.microsoft.com/en-us/library/vstudio/fcc1zstk.aspx and
> /SUBSYSTEM:Windows.
> For an example .def file (thats has been made for a dll but should work ok)
> look at http://dlang.org/dll.html at mydll.def.
>
> The later should work for both 64bit and 32bit I believe.
July 24, 2013
On Wednesday, 24 July 2013 at 10:20:08 UTC, Leandro Motta Barros wrote:
> For Win32/OPTLINK, I passed the following flag to dmd in a lil' project of mine:
>
>    -L/SUBSYSTEM:WINDOWS:4.0
>
> Worked for me.

Yes, this is the way to do it. But if you're going to specify a subsystem version number, I believe 5.01 is the version to use for 32-bit x86 and 5.02 for 64-bit. 4.0 is the subsystem version for Win9x support. Not that it will hurt anything to use it, and I don't really know the details of the how it affects the startup process, but it's recommended to use 5.01 or 5.02 these days.
July 24, 2013
Thank you all. All ok!
July 24, 2013
On Wednesday, 24 July 2013 at 08:24:03 UTC, Rikki Cattermole wrote:
> Take a look at DLL def files. I believe from memory that they will help with that.

Yeah, that or the linker flag. I talked about the .def file in this thread:

http://forum.dlang.org/thread/xkvdpdsfzevanucrgkud@forum.dlang.org


This has got to be one of the most frequently asked questions in here, we should really make an easy to see note somewhere!