Curious if anyone else encounters this.
Normally, if you build an FLTK app with /SUBSYSTEM:CONSOLE:
..which is all fine in the Windows universe as I've seen it for
the last 20 years.
However, with windows 10, there's some new weird behavior I
haven't seen before,
wondering if anyone else encounters this:
1) If I invoke it from a DOS window, an
/extra/ dos window opens when it runs (WTF?)
2) If I invoke it from a DOS window /running as
administrator/, no extra DOS window appears (OK)
3) If I invoke it from a PowerShell, no extra DOS window
appears (OK)
#1 seems really really odd to me. Never seen that before.
The customer sees this too, and I don't know what to make of it,
and wasn't able
to find info on this, as I imagine GUI apps aren't usually also
console apps.
Trying to figure out what's wrong here; I assume Windows is seeing
this console
app as something different from normal, probably because FLTK is
creating a WinMain()
internally, and that's somehow triggering Windows with this new
behavior.
Might be a bug, as it's weird that the old normal behavior happens
if it's an administrator owned
DOS window.
On 4/19/21 7:29 PM, Greg Ercolano wrote:
[..] However, with windows 10 [..]
1) If I invoke it from a DOS window, an /extra/ dos window opens when it runs (WTF?)
[..]
Might be a bug, as it's weird that the old normal behavior happens if it's an administrator owned DOS window.
1) If I invoke it from a DOS window, an /extra/ dos window opens when it runs (WTF?)
Oh and I cannot confirm this observation. The executable is launched within the calling DOS window (and also prints cout / cerr there).
I am using FLTK 1.3.5
My compile/link flags look like this, FWIW:
Greg, I *believe* this is caused by our (FLTK) WinMain() function and the build flags. I did a test on my Win10 machine and built the stock FLTK 1.3.6 test programs with some modifications [1] with VS 2019.
Since you are using FLTK, how did you build FLTK? Debug or Release mode? This can make a difference (see below).
My compile/link flags look like this, FWIW:
I don't understand the MS commandline, but what I can say is: If I build the FLTK lib in debug mode and set the WIN32 option on the CMake the resultant program is a GUI program, otherwise it's a console application.
If I remove the WIN32 flag from fl_create_example there's no console window and both debug and release versions write to the DOS window w/o an extra console window.
If I set the WIN32 flag (the default) I can see that the FLTK WinMain() is called and opens the (extra) console window even if called from the DOS window.
My guess is that older Windows versions suppressed the extra console window created by
AllocConsole whereas Win10 always creates an extra window.
I suggest that you patch your FLTK version with my diff file for debugging to see if the FLTK WinMain() function is called and if that creates the extra console window.
Daniel G. (Giri) wrote that he could not confirm what you see. I assume that he built a non-FLTK program (or he built FLTK in Release mode).
Note: in my tests I used test/glpuzzle.cxx, built in Debug and Release mode with and w/o the WIN32 flag in fl_create_example (see patch). HTH.
Hey, I just did a quick test:
does your program have the option "Right Click -> Compatibility -> Run this program as an administrator" checked?
> Hmm, my copy of Win10 Home Edition doesn't have a "Compatibility" submenu when I right click on it
Oh I am sorry, I missed one step in my description.
You should find it via:
"Right Click -> Properties -> (Tab) Compatibility -> (Checkbox) Run this program as an administrator"
Also I cannot confirm your behaviour with the latest changes on the 1.3 branch.. (Neither Debug build nor Release build with /SUBSYSTEM:CONSOLE, built on Win10 with VS19)
On 4/20/21 11:18 AM, Albrecht Schlosser wrote:
This defines the WinMain() entry function.
# ifdef _DEBUG
AllocConsole();
freopen("conin$", "r", stdin);
freopen("conout$", "w", stdout);
freopen("conout$", "w", stderr);
# endif /* _DEBUG */
This opens the extra console window in debug mode, i.e. if "_DEBUG" is defined.
The main question is if this is (was) defined when the FLTK library is (was) built.
Definitely not compiled debug mode in my case.
And if it were, the AllocConsole() would always
appear, but it doesn't..
I'll try your patch test later today -- for reasons, I can't
apply changes to FLTK right now..
need to keep stability until I get through a delivery cycle.
However, with windows 10, there's some new weird behavior I haven't seen before, wondering if anyone else encounters this:
1) If I invoke it from a DOS window, an /extra/ dos window opens when it runs (WTF?)