netmaestro wrote: ↑Tue Feb 07, 2023 2:11 am
It has to be compiled as a console exe. compiler options->executable format->console then it will work fine.
Hi netmaestro. Yes agreed, that appears to ensure that the console assumes a foreground window, though the setting may not always be ideal for what we need. When the
Compiler Options - Executable format is changed to
Console, the resulting executable opens a normal window when running from the Windows explorer, which is fine, but if you run it from a command (cmd) shell, it doesn't open a new window. Instead, the input/output from the PB console application displays in the existing cmd shell. I accept this is a small point, but it is not ideal if a user executes an application from the command shell, that we want to display in its own window.
It seems that some users' systems don't exhibit the console opening in the background anyway. For me, on PB6.0, it has always happened and looking at BrianW's post and this thread, it is happening for others (perhaps for newer users have have come straight to PB6.0?). I have produced a downloadable video at the below link showing it happening. I start with it set to
Windows, then compile and execute the routine. I show it with a small explorer window and then a full-screen explorer window. In both cases, the console application appears behind the explorer window and in the full-screen explorer, the console window is completely obscured. At the end of the video I change to the
Console setting and it's fine.
Regarding the
Console setting, the below is how it appears when executing from the cmd shell.
This link contains the MP4 — it is a downloadable file,
not a streaming site :
https://ufile.io/6rzinc9p