【问题标题】:How to run process with no window如何在没有窗口的情况下运行进程
【发布时间】:2022-01-09 01:03:32
【问题描述】:
Process.run(
  'adb',
  ['devices],
  runInShell: true,
);

当我在 android studio 中运行应用程序时,没有黑窗, 但是当我双击***.exe运行该应用程序时,它会看到黑色窗口

【问题讨论】:

  • 这是 Windows 运行控制台模式应用程序的方式。
  • @jamesdlin Flutter 桌面应用程序不是控制台模式。问题在于 Dart 如何产生进程。

标签: windows flutter dart process flutter-desktop


【解决方案1】:

这是a Dart bug

作为described in the comments there,您现在可以通过在启动时创建自己的控制台并将其隐藏来解决它:

if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
  CreateAndAttachConsole();
} else {
  AllocConsole();
  ShowWindow(GetConsoleWindow(), SW_HIDE);
}

【讨论】:

    猜你喜欢
    • 2016-03-24
    • 1970-01-01
    • 2011-04-29
    • 1970-01-01
    • 2011-02-25
    • 1970-01-01
    • 2020-12-29
    • 2012-05-21
    • 1970-01-01
    相关资源
    最近更新 更多