c++ - Win32 GUI app -- hide console window
- Erik Weber (25/25) Mar 12 2011 Hello all. I've seen this question asked many times, and I have
- Erik Weber (7/7) Mar 12 2011 One more thing to note:
- Erik Weber (13/38) Mar 12 2011 Well I feel dumb for missing this, but one solution was right
- torhu (3/11) Mar 13 2011 I think you just need to add the .def file to the dmc's command line.
- Walter Bright (2/25) Apr 01 2011 Add the .def file to the command line to dmc.
- Erik Weber (7/7) Apr 11 2011 Thanks for the answers guys.
Hello all. I've seen this question asked many times, and I have tried the suggestion that I frequently see. But still, I get a console window when I run my exe file generated with digital mars compiler. Here is my compile command: dmc -I '<DirectX lib path>;<DirectX include path>;.' -cpp -mn -WA <MyWin32GUIApp>.cpp I have placed a file called <MyWin32GUIApp>.def in the same directory as the source file with these contents: EXETYPE NT SUBSYSTEM WINDOWS My source file uses WinMain and no main. I don't use any cout or printf statements. What am I missing? I have read that this might have something to do with linking . . . Do I need any special arguments to make sure the .def file is respected, or is it good enough that it simply exists? Is there something I need to specify in WinMain? I have seen solutions that quickly get a handle to the console window and hide it just after it has been shown but the real solution I'm looking for is to suppress it in the first place the way a "professional" Windows application does. Please help. Thanks, Erik
Mar 12 2011
One more thing to note: I am compiling this app with the free version of the C++ compiler but I have the pay version and can switch to that if I need to. I just haven't needed it yet but will once I solve this problem and move on to resource compiling. Thanks, Erik
Mar 12 2011
Well I feel dumb for missing this, but one solution was right there in the FAQ. Somehow I looked right at it and missed it or maybe it was added later: "or add the linker flag -L/exet:nt/su:windows" This works! As for the .def file solution, I'm pretty new to using the linker. Perhaps I did not properly tell the linker about my .def file? It's in the current directory which is in the -I path. Thanks, Erik == Quote from Erik Weber (my_name_here mindspring.com)'s articleHello all. I've seen this question asked many times, and I have tried the suggestion that I frequently see. But still, I get a console window when I run my exe file generated with digital mars compiler. Here is my compile command: dmc -I '<DirectX lib path>;<DirectX include path>;.' -cpp -mn -WA <MyWin32GUIApp>.cpp I have placed a file called <MyWin32GUIApp>.def in the same directory as the source file with these contents: EXETYPE NT SUBSYSTEM WINDOWS My source file uses WinMain and no main. I don't use any cout or printf statements. What am I missing? I have read that this might have something to do with linking . . . Do I need any special arguments to makesurethe .def file is respected, or is it good enough that it simply exists? Is there something I need to specify in WinMain? I have seen solutions that quickly get a handle to the console window andhideit just after it has been shown but the real solution I'm looking for is to suppress it in the first place the way a "professional" Windows application does. Please help. Thanks, Erik
Mar 12 2011
On 12.03.2011 23:01, Erik Weber wrote:Well I feel dumb for missing this, but one solution was right there in the FAQ. Somehow I looked right at it and missed it or maybe it was added later: "or add the linker flag -L/exet:nt/su:windows" This works! As for the .def file solution, I'm pretty new to using the linker. Perhaps I did not properly tell the linker about my .def file? It's in the current directory which is in the -I path.I think you just need to add the .def file to the dmc's command line. But using the linker flag seems a cleaner solution anyway.
Mar 13 2011
On 3/12/2011 11:16 AM, Erik Weber wrote:Hello all. I've seen this question asked many times, and I have tried the suggestion that I frequently see. But still, I get a console window when I run my exe file generated with digital mars compiler. Here is my compile command: dmc -I '<DirectX lib path>;<DirectX include path>;.' -cpp -mn -WA <MyWin32GUIApp>.cpp I have placed a file called<MyWin32GUIApp>.def in the same directory as the source file with these contents: EXETYPE NT SUBSYSTEM WINDOWS My source file uses WinMain and no main. I don't use any cout or printf statements. What am I missing? I have read that this might have something to do with linking . . . Do I need any special arguments to make sure the .def file is respected, or is it good enough that it simply exists? Is there something I need to specify in WinMain? I have seen solutions that quickly get a handle to the console window and hide it just after it has been shown but the real solution I'm looking for is to suppress it in the first place the way a "professional" Windows application does. Please help.Add the .def file to the command line to dmc.
Apr 01 2011
Thanks for the answers guys. I now have applications running without the console window. My next challenge is to learn how to use the resource compiler to package my bitmaps. So don't be surprised to see some more questions. Thanks, Erik
Apr 11 2011