koishijs / koishi-desktop

Launch Koishi from your desktop
https://koishi.chat/manual/starter/
GNU Affero General Public License v3.0
89 stars 7 forks source link

Windows 上子进程弹出控制台窗口 #63

Closed ilharp closed 2 years ago

ilharp commented 2 years ago

使用以下方法解决:

构建 Console Application 后,启动时调用

import "github.com/gonutz/w32/v2"

func hideConsole() {
    console := w32.GetConsoleWindow()
    if console == 0 {
        return
    }
    _, consoleProcID := w32.GetWindowThreadProcessId(console)
    if w32.GetCurrentProcessId() == consoleProcID {
        w32.ShowWindowAsync(console, w32.SW_HIDE)
    }
}
ilharp commented 2 years ago

调研已结束,上述方法不可使用,该问题无解。

将使用类 Bootstrap 方式实现需求。

ilharp commented 2 years ago

调研已修正,上述方法可以使用,该问题有解。

将使用上述方法实现需求。

ilharp commented 2 years ago

Fixed by:

ilharp commented 2 years ago

Defect: Windows Terminal will only hide its window.

Related:

Solution:

Describe workarounds below in our documents.

  1. Enable Options -> Use Legacy Console in executable properties

  2. Use shortcuts provided by MSI installer (start using conhost)