[Geany-Devel] debug output on win32

Dimitar Zhekov dimitar.zhekov at xxxxx
Tue Mar 24 18:23:24 UTC 2015

On 23.3.2015 г. 13:44, Enrico Tröger wrote:

> This is because on Windows you have to decide at compile time whether
> you want to have a console application or a graphical application.
> Console applications can print directly to the terminal but not
> graphical applications.

To be precise, when started from a console application, such as the 
shell, graphical applications can attach to their parent's console:

WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "boza", 4, &n, NULL);

It may be possible to create a file descriptor with _open_osfhandle() 
and replace stdout (and the others) with dup2(), I haven't tested.

The mpv player (a fork of MPlayer) under Windows uses it's parent 
console, if any.

E-gards: Jimmy

More information about the Devel mailing list