Skip to content

Commit

Permalink
directvt#571: Detect GUI mode
Browse files Browse the repository at this point in the history
  • Loading branch information
o-sdn-o committed Feb 18, 2024
1 parent e2a3602 commit 5673542
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/netxs/desktopio/system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3488,6 +3488,20 @@ namespace netxs::os
}
else
{
ok(::FreeConsole(), "::FreeConsole()", os::unexpected);
if (::AttachConsole(ATTACH_PARENT_PROCESS))
{
os::stdin_fd = fd_t{ ptr::test(::GetStdHandle(STD_INPUT_HANDLE ), os::invalid_fd) };
os::stdout_fd = fd_t{ ptr::test(::GetStdHandle(STD_OUTPUT_HANDLE), os::invalid_fd) };
os::stderr_fd = fd_t{ ptr::test(::GetStdHandle(STD_ERROR_HANDLE ), os::invalid_fd) };
}
else
{
// Run gui console.
::MessageBoxW(NULL, L"Run GUI-console.", L"Run GUI-console.", MB_OK);
os::process::exit<true>(0);
}

dtvt::win_sz = dtvt::consize();
#if defined(_WIN32)
{
Expand Down

0 comments on commit 5673542

Please sign in to comment.