Win 11 console

Windows specific questions.
shadow008
Posts: 86
Joined: Nov 26, 2013 2:43

Re: Win 11 console

Post by shadow008 »

This discussion about the windows 11 console might be related: viewtopic.php?p=299650#p299650

Edit:
Looks like the fix for this issue came Sept 26th. Check if you have terminal 1.18.X or a later version; upgrade if you haven't. If you do have the latest and are still experiencing the issue, then... good luck.
UEZ
Posts: 988
Joined: May 05, 2017 19:59
Location: Germany

Re: Win 11 console

Post by UEZ »

srvaldez wrote: Dec 18, 2023 1:01 @UEZ
unfortunately all I get is (program exited with code: 1000)
Hmmm, which operating system are you using? x64 or x86?
adeyblue wrote: Dec 18, 2023 3:33
UEZ wrote: Dec 17, 2023 23:17 Dim As String sConhost = _WinAPI_FindFile("C:\Windows\WinSxS\amd64_microsoft-onecore-console-host-core_*", "conhost.exe")
In 32-bit apps you can use sysnative to access the 64-bit system32 folder without it being redirected to syswow64, like
C:\Windows\Sysnative\conhost.exe
It is only recognised by 32-bit apps on 64-bit Windows though, so you still need different things for 32- and 64-.

You can also just turn off the the system32 -> syswow64 thing temporarily so you can use system32 to mean actual system32 in all cases with
Wow64DisableWow64FsRedirection
It does affect things like dll loading though, so when it's off, all the LoadLibrary of windows dlls will fail as it'll be trying to load the 64-bit dlls.
Thanks for the sysnative hint. :) Works fine -> https://freebasic.net/forum/viewtopic.p ... 67#p301467
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Win 11 console

Post by srvaldez »

UEZ wrote: Dec 18, 2023 12:22 Hmmm, which operating system are you using? x64 or x86?
Windows 11 x64, most of the time I compile with fbc64
UEZ
Posts: 988
Joined: May 05, 2017 19:59
Location: Germany

Re: Win 11 console

Post by UEZ »

srvaldez wrote: Dec 18, 2023 12:44
UEZ wrote: Dec 18, 2023 12:22 Hmmm, which operating system are you using? x64 or x86?
Windows 11 x64, most of the time I compile with fbc64
That's strange, I'm on the same system. End 1000 will occur always because first run will be ended and recalled with "restart" parameter to skip first run check but afterwards the code should run in the cmd window instead of the terminal window.
Does it work when compiled it as x86?
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Win 11 console

Post by srvaldez »

no, same result
by the way, I am running Windows 11 Version 10.0.22631 Build 22631, I think it's the insiders preview version
UEZ
Posts: 988
Joined: May 05, 2017 19:59
Location: Germany

Re: Win 11 console

Post by UEZ »

srvaldez wrote: Dec 18, 2023 12:59 no, same result
by the way, I am running Windows 11 Version 10.0.22631 Build 22631, I think it's the insiders preview version
Maybe a silly question but how you start the compiled exe?

Btw, I'm on Win11 22H2 build 22621.2715.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Win 11 console

Post by srvaldez »

not a silly question at all, I think that it's relevant, I use the geany IDE and launch my programs from the IDE
geany's execute command is cmd.exe /Q /C %c
as far as I have been able to figure out, %c is the run-command, in windows it's the following batch file

Code: Select all

REM USAGE: geany-run-helper DIRECTORY AUTOCLOSE COMMAND...

REM unnecessary, but we get the directory
cd %1
shift
REM save autoclose option and remove it
set autoclose=%1
shift

REM spawn the child
REM it's tricky because shift doesn't affect %*, so hack it out
REM https://en.wikibooks.org/wiki/Windows_Batch_Scripting#Command-line_arguments
set SPAWN=
:argloop
if -%1-==-- goto argloop_end
	set SPAWN=%SPAWN% %1
	shift
goto argloop
:argloop_end
%SPAWN%

REM show the result
echo:
echo:
echo:------------------
echo:(program exited with code: %ERRORLEVEL%)
echo:

REM and if wanted, wait on the user
if not %autoclose%==1 pause
UEZ
Posts: 988
Joined: May 05, 2017 19:59
Location: Germany

Re: Win 11 console

Post by UEZ »

What happens if you start the compiled exe from the windows explorer window? Same?
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Win 11 console

Post by srvaldez »

when launched from the Windows explorer then it works as you had intended, but that doesn't help my situation where I need to launch my stuff from the geany IDE, dodicat would probably launch his stuff from FBIDE
UEZ
Posts: 988
Joined: May 05, 2017 19:59
Location: Germany

Re: Win 11 console

Post by UEZ »

I installed Geany to test it, and it worked as desired. FBIDE is working, too.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Win 11 console

Post by srvaldez »

UEZ, it's an interesting solution but unfortunately it doesn't work for me but perhaps it works for others, in the meantime I simply switch over to conhost and if I and this country live long enough for when conhost is not supported anymore then I will use the crt functions printf and scanf
UEZ
Posts: 988
Joined: May 05, 2017 19:59
Location: Germany

Re: Win 11 console

Post by UEZ »

srvaldez wrote: Dec 18, 2023 15:06 UEZ, it's an interesting solution but unfortunately it doesn't work for me but perhaps it works for others, in the meantime I simply switch over to conhost and if I and this country live long enough for when conhost is not supported anymore then I will use the crt functions printf and scanf
Live a long and healthy life.

Perhaps it is best to switch to CMD via the settings, as dodicat has described. My workaround is without the manual switch to CMD, because I have not found a better solution yet.
Post Reply